Skip to content

Instantly share code, notes, and snippets.

View jacquescrocker's full-sized avatar

Jacques Crocker jacquescrocker

View GitHub Profile
@jacquescrocker
jacquescrocker / gist:2001302
Created March 8, 2012 14:44
responsive.is bookmarklet
javascript:(function()%7Bvar%20location=(%22http://responsive.is/%22+window.location.host+window.location.pathname);if(location.substring(location.length-1)==%22/%22)%7Blocation=location.substring(0,location.length-1);%7Dwindow.location=location;%7D)();
ack 1.94
atk 2.0.1
bcrypt 1.1
boost 1.47.0
chmlib 0.40
cmake 2.8.5 2.8.7
coffee-script 1.1.2
couchdb 1.1.0
ctags 5.8
curl 7.21.7
@jacquescrocker
jacquescrocker / output.log
Created February 8, 2012 22:11
Falcon switch on a nontrivial rails app
Results from https://gist.github.com/1688857
# 1.9.2
jc@mac# time script/rails runner 'puts "HELLO"'
HELLO
real 0m27.264s
user 0m22.856s
sys 0m2.989s
Installed RVM master version:
rvm 1.10.2 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.beginrescueend.com/]
RVM reloaded!
RVM reloaded!
Fetching yaml-0.1.4.tar.gz to /Users/jc/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/jc/.rvm/src
Configuring yaml in /Users/jc/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/jc/.rvm/src/yaml-0.1.4.
@jacquescrocker
jacquescrocker / gist:1773910
Created February 8, 2012 21:10
Setting up Fast Ruby (1.9.3)
# update rvm
rvm get latest
# create a 1.9.3 patch
export patchdir=$rvm_path/patches/ruby/1.9.3/p0
mkdir -p $rvm_path/patches/ruby/1.9.3/p0
curl https://raw.github.com/gist/1658360/2eee5541435663deddd674617bf26ae645b015bd/cumulative_performance.patch > $rvm_path/patches/ruby/1.9.3/p0/falcon.patch
# install patched version
rvm install 1.9.3 -n falcon --patch $patchdir/falcon.patch --with-gcc=clang
@jacquescrocker
jacquescrocker / _compass_mini.scss
Created February 7, 2012 23:22
Compass Mini (just the css3 parts) 400ms vs 1700ms for @import "compass/css"
/////////////////////
// compass/_support.scss
//
// Usually compass hacks apply to both ie6 & 7 -- set this to false to disable support for both.
$legacy-support-for-ie: true !default;
// Setting this to false will result in smaller output, but no support for ie6 hacks
$legacy-support-for-ie6: $legacy-support-for-ie !default;
// Setting this to false will result in smaller output, but no support for ie7 hacks
# extend underscore with some string helper methods
_.mixin
htmlEncode: (value) ->
$('<div/>').text(value).html()
htmlDecode: (value) ->
$('<div/>').html(value).text()
# take a number and formats it with delimiters
# "1000" => "1,000"
<script type='text/javascript' src='<%= Settings.site_url %>/assets/vendor/jquery-1.7.1.js'></script>
<script type='text/javascript'>
var $angelJQ = jQuery.noConflict();
$angelJQ(document).ready(function($) {
console.log("LOADING!")
});
</script>
$(".resend_auth").live "click", (e) ->
e.preventDefault()
link = $(this)
$.ajax
url: link.attr("href")
dataType: "json"
success: (json) ->
alert(json.msg)
# update token data from an OAuth2::AccessToken
def from_token!(token)
new_token_data = {
"token" => token.token,
"expires_in" => token.expires_in,
"expires_at" => token.expires_at,
}
# add back refresh token
if token.refresh_token.present?