Skip to content

Instantly share code, notes, and snippets.

View jeffsaracco's full-sized avatar

Jeff Saracco jeffsaracco

View GitHub Profile
@jeffsaracco
jeffsaracco / gist:11299917
Created April 25, 2014 19:10
Clang error
@jeffsaracco
jeffsaracco / api.rb
Created April 17, 2014 22:06
Grape root route
#app/api/grape_test_api/api.rb
module GrapeTestAPI
class API < Grape::API
version 'v1', using: :header, vendor: 'twitter'
format :json
get 'hello' do
"hello world"
end
@jeffsaracco
jeffsaracco / Vim-hash-search-and-replace.md
Last active March 19, 2018 13:01
Vim search and replace to change old ruby hash syntax (ie: :symbol => 'value') into new ruby hash syntax (ie: symbol: 'value')

For old ruby hash syntax with symbols %s/:\([a-z_]\+\) =>/\1:/gc

For old syntax with strings %s/"\([a-z]\+\)" =&gt;/\1:/gc

Keybase proof

I hereby claim:

  • I am jeffsaracco on github.
  • I am jeffsaracco (https://keybase.io/jeffsaracco) on keybase.
  • I have a public key whose fingerprint is E412 5702 FCC8 7517 609E FC3A 45F0 031D BFCB F83C

To claim this, I am signing this object:

@jeffsaracco
jeffsaracco / gallery_view.coffee
Created February 24, 2014 20:24
Gallery View for Backbone
@jeffsaracco
jeffsaracco / image_dimensions.coffee
Created February 21, 2014 15:56
Get image dimensions in coffeescript
onRender: ->
@$('#fileupload').fileupload
dropZone: @$(@itemViewContainer)
headers:
token: App.Entities.Session.getCurrentSession().get("token")
dataType: 'json',
# done: (e, data) =>
# @collection.push(new App.Entities.Image(data.result))
add: (e, data) =>
@getFileSize(data)
@jeffsaracco
jeffsaracco / multiple_heroku_keys.md
Last active August 29, 2015 13:56
Multiple Heroku keys

In your .git/config

  [remote "heroku"]
     url = [email protected]:<appname>.git

In your .ssh/config

Host heroku.work

@jeffsaracco
jeffsaracco / active_model.rb
Created January 21, 2014 16:46
Active Model with no DB
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
@jeffsaracco
jeffsaracco / gist:7267186
Created November 1, 2013 15:32
ActiveAdmin has_many nested form
form(:html => { :multipart => true }) do |f|
f.inputs 'Main name' do
f.input :name
end
f.inputs "Other sub-piece" do
f.input :other_field_from_main_thing
f.has_many :other_things do |thing|
thing.inputs "things" do
@mixin background-image-retina($file, $type, $width, $height) {
background-image: url($file + '.' + $type);
@media (-webkit-min-device-pixel-ratio: 2), (-moz-min-device-pixel-ratio: 2) {
& {
background-image: url($file + '@2x.' + $type);
-webkit-background-size: $width $height;
}
}
}