This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BootstrapFormBuilder < ActionView::Helpers::FormBuilder | |
['text_field', 'text_area'].each do |helper| | |
define_method helper do |field, *args| | |
options = args.detect{ |a| a.is_a?(Hash) } || {} | |
if @object.errors[field].any? | |
'<div class="clearfix error">'.html_safe + | |
(self.label field) + | |
'<div class="input">'.html_safe + | |
(super field, *args) + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
label() { | |
printf '\033[1;30;43m %s \033[0m\n' $1 | |
} | |
# jQuery | |
label jquery-1.6.4.min.js | |
curl http://code.jquery.com/jquery-1.6.4.min.js > jquery-1.6.4.min.js | |
# Backbone.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
padding-top: 60px; | |
} | |
.hero-unit img { | |
margin: -50px -30px 0px 0px; | |
float: right; | |
} | |
.btn.tiny { | |
padding: 2px 4px; | |
font-size: 11px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Prepare the API call | |
$search_string = urlencode("City of God"); | |
$API_KEY = "<redacted>"; | |
$URL = "http://api.themoviedb.org/2.1/Movie.search/en/xml/{$API_KEY}/{$search_string}"; | |
// Perform the API call | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $URL); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/node | |
/** | |
* Example usage: | |
* | |
* curl https://api.twitter.com/1/statuses/public_timeline.json | json 2.text | |
* curl https://api.twitter.com/1/statuses/public_timeline.json | json 0.user | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fontprep () | |
{ | |
# Move to the server folder | |
cd /Applications/FontPrep.app/Contents/Resources/fontprep_server | |
# Start the FontPrep server, fork the process and store it's pid | |
ruby src/main.rb & pid_server=$! | |
# Give some time for the server to start, then open the URL in Google Chrome's app mode | |
sleep 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This gulpfile adds three tasks to bump the semver release: bump:major, bump:minor, bump:patch. | |
// First, it checks if the git repository is clean, and fails with an alert otherwise, then: | |
// - Update manifests (in this example, package.json and Info.plist) | |
// - Add manifests to the git stage | |
// - Commit changes in the manifests with the message "Prepare for vX.Y.Z" | |
// - Tag the release | |
// All that is left for the user to do is push the commit/tag to the remote repo with `git push --tags` | |
var gulp = require('gulp'); | |
var semver = require('semver'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Search reddit for a string | |
redsearch() { | |
curl "http://www.reddit.com/search.json?q=$1" | jq '[.data.children[].data | {created_utc, permalink, num_comments, ups, author, subreddit, url, title} | select(.title | contains("'$1'"))] | sort_by(.created_utc)' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function find_git_branch { | |
local dir=. head | |
until [ "$dir" -ef / ]; do | |
if [ -f "$dir/.git/HEAD" ]; then | |
head=$(< "$dir/.git/HEAD") | |
if [[ $head == ref:\ refs/heads/* ]]; then | |
git_branch="${head#*/*/}" | |
elif [[ $head != '' ]]; then | |
git_branch='(detached)' | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Author</key> | |
<string>Bruno Daniel</string> | |
<key>Builder Version</key> | |
<string>10600.5.17</string> | |
<key>CFBundleDisplayName</key> | |
<string>Viewport Width</string> |
OlderNewer