noexec - Run Ruby scripts without bundle exec
thechangelog:
We’ve covered a few of Josh Hull’s projects on this blog. His latest is so simple, yet quite useful. If you use Bundler, you probably spend a good part of your day running bundle exec. I even use a zsh alias be for this purpose. Well now, we can stop.
With noexec, Josh has created a small script that will walk up your directory structure until it can find a Gemfile. If the executable you’re running is in that Gemfile, it will use it instead of Bundle.setup.
Simply install the gem:
gem install noexec
… and be sure to export the following environment variable in your shell profile:
RUBYOPT="-r`noexec`"
Check the source on GitHub for more.
(Source: thechangelog)
9:29 am • 30 March 2012 • 6 notes
Clean up your GMail inbox, the fast and safe way
I have 10,000+ unread emails in my GMail inbox! Yes, WTF?!!! I started using GMail before it was offered for free. A friend of mine gave me an invite to the next best thing that was ever created after the coffee maker. That was around 2004 or 2005? So, 5 or 6 years of love, I got fatty inbox. And yes, I wasn’t really going into cleaning up.
Until one hazed afternoon, coding and all, I…
1. Search a keyword, I tested with “Facebook”
2. The search result gave me 20 items, and at the bottom it says “20 of hundreds”, tick (check mark) the Select All option (at the left upper corner of the search result section).
3. Notice that a notification will be displayed right above the first item in the search results that says: “All 20 conversations on this page are selected. Select all conversations that match this search.” The second sentence is a link. Click it.
4. The notification are will then say “All conversations in this search are selected. Clear selection.” You can cancel by clicking the second sentence again.
5. Click the Delete button, then click Ok on the pop-up confirmation.
Then my inbox came down to 6000+! (Yeah, a long way to go)
3:50 am • 20 October 2010
Cufon + IE - headache
With Cufon, you can use FREE fonts for your website. It kicks the boredom out of the same old system (OS-dependent) fonts, will beautify your site (if used the right way), cook you dinner and feed your dog.
I would advice checking out Github (the social networking for geeks) and the wiki for Cufon. Consult your Aunt Google for the FREE fonts. Then head to the Cufon Generator site to squeeze the goodness. Afterwards, use it on your site.
Because you never really cared about IE and all the death traps it gives then your friend, boss, girlfriend and grand parents called you up and said your site sucks! But it looks good on my machine?! You missed the kicker, buddy!
<script type="text/javascript"> Cufon.now(); </script>
Add the code above right before the </body> line of your page or template. I got the word ‘before’ in bold, that is for a good reason. I was scratching my head long enough figuring out what was wrong.
How I failed? 1. I forgot to add the line, because of my eternal love to non-IE browsers and 2. I forgot to read through the documentation where I should put the line.
Grab a bottle of beer, call your girlfriend, or your boss, or your grand parents and tell them how kick-ass your site looks now on IE. Of course after you tested.
7:53 am • 5 October 2010
Validate File Field with jQuery validationEngine
jQuery validationEngine is the prettiest form validation plugin that I have used in most of my latest projects. Unfortunately, the plugin did not include the file field validation which occur on forms with attachments. After scouring around for quick solution from others, I end up empty handed. So, here’s a basic approach:
Assumptions:
- you already have the jquery and the javascript files that comes with validationEngine as well as the stylesheets.
- you have the corresponding javascript and stylesheet files called in your page’s head section
- if you don’t understand any of the items I mentioned above, review Position Absolute’s article on validationEngine.
1. Squeeze in a rule to jquery.validationEngine-en.js (the text in bold from the snippet below)
“onlyLetter”:{
“regex”:”/^[a-zA-Z\ ']+$/”,
“alertText”:”* Letters only”},
“validatefile”:{
“nname”:”validatefile”,
“alertText”:”* An image (jpg or gif) file is required.”},
“validatepassword”:{
“nname”:”validatepassword”,
“alertText”:”* Password and password confirmation must be equal”}
}
2. On the page with the form, add the sample validatefile function (in bold below). Provided that you have the file field with an id of comment_image and is within the form with id comment_frm.
<script>
$(document).ready(function() {
$(“#comment_frm”).validationEngine()
});
function validatefile(){
if ($(“#comment_image”).val() == “”){
return false;
} else {
return true;
}
}
</script>
And that’s it. Test it! From this end you can then validate if the attachment is as you expect it based on the file extension. If you’re asking about validating the file size, you need to submit the form to the server and run a validation from there.
7:39 am • 30 September 2010 • 1 note
Resolve iPhone Restore/Update Error 14
Disclaimer: Tried and tested successfully on Mac and iTunes 9.2.1 with iPhone 3GS 4.0.1 on carrier SIM.
Intro
Make sure that you have a backup of all your apps, contacts, calendar, etc on your iTunes before doing any update. If you did not, chances are you will lose your iPod entries (music, movies, etc). But since iTunes keeps track of any changes you made on your iPhone, we can assume that your device is properly synced (not unless your attempt is on another computer?)
You tried to update, then waited for a couple of hours. Then you decided to abort the update in the middle of the process. Eventually, your phone will be bricked.
So, you restored, and ended up with the Error 14. If you are lucky, you won’t bump into this error.
Fix
1. Delete the IPSW files. Navigate to your Library folder, look for iTunes and iPhone Software Updates. If you see any .ipsw file in there move it to trash, empty your trash. According to some support entries in Apple, the error might have been caused my corrupted .ipsw file which would happen during the download if you have a not very stable connection.
2. Use updated iTunes. Make sure you are using the latest version of iTunes, as of today, the latest is version 9.2.1. Download it if you’re not on that version and install it.
3. Restore again. Connect your iPhone to your Mac. Since the previous ipsw file is now on the trash and deleted, iTunes will download another restore file (around 378MB). Take some time, do your laundry, walk your dog, call your girlfriend or watch Sponge Bob.
4. Click, click. Click through the notifications (it somehow makes a lot of sense so no need to elaborate here). iTunes will sync your iPhone to your latest backup. If you are using a different computer doing this, maybe you should sync again once you’re on your original rig (with the iPhone backup).
If you lost your app, you just need to install it again. This might sound simple, but if you have more than 30 app already, this might be a big headache. So just make sure you have the apps on the side so you can drop them anytime.
12:04 am • 22 August 2010
Jailbreak iTouch While Having a Cigarette
Disclaimer: My iTouch is on iOS 3.2.1. Yes a virgin. Never been freed. The jailbreak will be a breeze but the update could take some time from 45min to an hour depending on your WiFi connection.
Roll
1. Make sure you are on iOS 4.0 or iOS 4.01. If you’re not, plug your iTouch to your PC or Mac. iTunes will run and ask you to update. Don’t worry, this is not the update that bricked a lot of iDevices. IT IS SAFE TO UPDATE. That would take you an hour or less.
2. Open Safari and navigate to http://jailbreakme.com
3. Slide to Unlock
4. Wait until the process finishes the download process and jailbreak.
5. Once done, have fun!
Special Thanks
Special thanks to Comex and his brilliant mind! Also to all the iPhone Dev Team for all the contributions.
7:34 am • 4 August 2010
Jailbreak and Unlock Your iPhone 3GS While Having a Cup of Coffee
Disclaimer: This guide is for iPhone 3GS new bootrom on iOS 4.01. Previously activated with an official carrier (if you are in the Philippines and your iPhone is from Globe, that would not be a hassle, but if your iPhone is from the US or somewhere else you will need an official carrier or AT&T sim to activate before jailbreaking and/or unlocking).
Avoid the Purple Screen Issue
- Go to Settings > Safari
- Clear History, Cache and Cookies
- Turn your phone off and back on
Order a cup of coffee
- Head to the counter and give your barrista a wink
- Order for a grande americano (if you are in Makati City, head off to Coffee Bean and Tea Leaf at GreenBelt 3)
- Ask for the password to the WiFi
- Grab a seat, light a stick of cigarette
Jailbreak
- Open Safari
- Navigate to http://jailbreakme.com
- You will be prompted to backup. I did not. Fortunately, nothing funny happened.
- Slide to jailbreak (literally, but on your phone)
- Wait until the download is finished (you should be halfway your coffee by now)
- Once download is completed, continue with your coffee and “sit tight”.
- If you get the “Cydia has been added to the home screen. Have fun!” message, click OK
Unlock
- Look for Cydia somewhere in your home screen.
- Tap it. You will be promted to update, update it.
- Tap “Search”, at the bottom of the screen, near “Manage”
- Type “ultrasn0w”, tap on the first item in the search result.
- You will now be redirected to “ultrasn0w 0.93”, tap Install (at the right top corner)
- Tap “Confirm”
- If you got the sim loaded, in my case AT&T you will receive a message “Can’t Activate Sim”, just tap OK
- You will see some stuff on the background as ultrasn0w go through the process.
- As soon as things are done, turn off your phone.
- Eject the sim, replace it with the new sim that you want to use.
- Turn the phone and you’re done!
Special Thanks
More power and blessings to Comex and the iPhone Dev Team for putting their great minds together for this FREE stuff!
11:23 am • 3 August 2010 • 1 note
Disabled controls cannot be successful
Sometimes if not usual, you might want to use controls in a form for information purposes or you don’t want the user to mess with it. Good intention. But you might scratch your head of a couple of minutes wondering why the control and its corresponding values are not thrown as parameters?
Let’s go to HTML 101: readonly controls can be passed as parameters, disabled cannot. Like the samples below:
<input name=”dog” id=”the_dog” value=”spotty” readonly=”readonly”>
<input name=”cat” id=”the_cat” value=”furry” disabled>
If you want to dig deeper, read through the full technical description from w3.org
5:03 am • 25 July 2010 • 1 note
Free Facebook GUI PSD Kit
Been a regular of SmashingMagazine’s site and from yesterday’s post they featured Surgeworks’ Facebook GUI PSD Kit and available for download. View the full post here.
Download the PSD and roll-off with your Facebook Apps! And if you got more time, read through their other posts.
12:52 am • 24 July 2010