Compile you? I don't even know you!
Notes on software development for iOS and also real computers in Objective-C, Ruby on Rails, ActionScript 3 (Flash, Flex), Java, .Net (C#, mostly), PHP, SQL Server and MySql. Also notes on whatever technology problem I happen to find, including OSX, Windows and Linux stuff.
Monday, December 17, 2012
Date and Timestamp Trigger in OSX
I'm so proud that I finally just took on Applescript a bit and did a date script. It was a hassle, but I even did a method (whoot!).
So you put this in with the script editor and then save it to SOMEPLACE IN YOUR QUICKSILVER PATH. Then you configure a trigger and you're done.
2012-12-17 03:34
Sunday, December 9, 2012
Occasional Markdown Plugin
I'm not too into PHP now, nor was I ever into programming for Wordpress. However, I was not happy with the Markdown options available.
I want this:
<pre class="markdown">**Markdown here!**</pre>**this is not markdown**<pre class="markdown">**More markdown here!**</pre>
To come out like this:
Markdown here!
**this is not markdown**
More markdown here!
So I made a plugin in Wordpress to do that. Of course, all the work was already done. Also, I have no idea if this is safe or not for your Wordpress installation. I haven't tested with comments, especially, which are user input, so be careful.
Anyway, check it out in my Github fork.
Thursday, November 29, 2012
Everwatch, Evernote, Marked
Updated Instructions
I love Brett Terpstra's Marked, and its integration with Evernote is barebones and cool. Anyway, the instructions are:- Get the everwatch.rb script from here
- As written about here change line 8 to say
watch_folder = File.expand_path("~/Library/Application Support/Evernote/accounts/Evernote") - Run it in the background by using something
~/scripts/everwatch.rb &
I've Been Checking It Out, Now It's Broken!
You'll notice at some point that the script blows up, and if you're observant (or lucky, as I was) you'll note that it's the apostrophes that make it blow up. So replace the line that says:# convert the contents to plain text
txtnote = %x{echo '#{note}'|textutil -stdin -convert txt -stdout}
with this whole shebang
note = note.gsub("'","APOSTROPHEEE")
# convert the contents to plain text
txtnote = %x{echo '#{note}'|textutil -stdin -convert txt -stdout}
txtnote = txtnote.gsub("APOSTROPHEEE", "'")
While I'm here, I'll add my meager attempt to translate the bullets. It actually works (well, so far):
txtnote = txtnote.gsub("\t•","-") # 1st indent
txtnote = txtnote.gsub("\t◦"," -") # 2nd indent becomes 4 spaces
# evernote numbering, but only one level
txtnote = txtnote.gsub(/\t\d{1,4}\.\t/, "1. ")
And then you'll notice that second level Markdown bullets don't work, so add this:
txtnote = txtnote.gsub("\302\240", " ") # some bizarre space-looking character textutil or Evernote uses
Then I went crazy and redid the script a bit. Now it opens Marked on it's own (if you have the filetypes associated) and is less brittle to changes. Performance is the same (and Command-S in Evernote does help):
txtnote = txtnote.gsub("\t•","-") # 1st indent
txtnote = txtnote.gsub("\t◦"," -") # 2nd indent becomes 4 spaces
# evernote numbering, but only one level
txtnote = txtnote.gsub(/\t\d{1,4}\.\t/, "1. ")
And then you'll notice that second level Markdown bullets don't work, so add this:
txtnote = txtnote.gsub("\302\240", " ") # some bizarre space-looking character textutil or Evernote uses
Then I went crazy and redid the script a bit. Now it opens Marked on it's own (if you have the filetypes associated) and is less brittle to changes. Performance is the same (and Command-S in Evernote does help):
Monday, October 1, 2012
Don't Commit If Submodule Is Dirty
Thanks to my question here I wrote this script:
Like in all things, you probably don't want to commit if the submodules are dirty ;)
Thursday, September 27, 2012
Get Properties of Type in Self
This Objective-C category is of extremely limited utility, since it will not handle a hierarchy deeper than super and subclass. However, it saved me today, and that's what I needed.
Use it like this:
Use it like this:
Tuesday, September 4, 2012
UIView That Allows Interactions With Views Behind It
A UIView that allows interaction with the stuff behind it, and the stuff in it. Great. This is taken from my remix answer here on StackOverflow.
The normal way to do this is to set allowsUserInteraction to NO, but this does not allow any interaction with the subviews of the present class.
The normal way to do this is to set allowsUserInteraction to NO, but this does not allow any interaction with the subviews of the present class.
Saturday, August 25, 2012
Using Static Libraries in Apps in Xcode
I looked at a ton of misinformation and confusing information on StackOverflow to try to do this. Between my ADD and possibly outdated answers, I decided to spin my own. It's got some manual stuff in it, but it works. Here's what the solution looks like
Project 2 is a static library. Project 1 is your app.
Project 2 is a static library. Project 1 is your app.
- Close Project 2. Yes, you have to do this.
- Using drag and drop or add files, add Project 2 to Project 1.
- In the root directory for Project 1, add a soft link to the directory where Project 2's sources are kept. So in this example, I'm in /myMillionDollarProjects/UsingConfusionUtil and I type
ln -s /myMillionDollarProjects/ConfusionUtil ConfusionUtil - Exclude this link from git by adding the name of your soft link to your .gitignore (in this case, ConfusionUtil).
- In User Header Search Paths for Project 1, add the name of the soft link (in this case, ConfusionUtil).
- Check the box to the left of that which means "recursive." This just adds a forward-slash followed by two asterisks to the name (so in this case, I see ConfusionUtil/**).
- In Build Phases for Project 1, under Link Binary With Libraries, add the .a for Project 2.
- In your Other Linker Flags, add -ObjC with the leading dash (otherwise categories won't work)
- Try to reference something from Project 2 in Project 1. Don't just compile, but also run to make sure it's all correct.
Special Note: You cannot add nibs this way, nor is there a concept of a bundle on iOS. You have to add the nibs as individual files, although I'm going to investigate making a fake app target and adding them that way.
Note: If you need to use static libs, you can figure all these issues out and more, but personally the distribution provision cert issues proved to be too much.
Note: If you need to use static libs, you can figure all these issues out and more, but personally the distribution provision cert issues proved to be too much.
Subscribe to:
Posts (Atom)