Skip to content

Instantly share code, notes, and snippets.

View juggy's full-sized avatar
🎯
Focusing

Julien Guimont juggy

🎯
Focusing
View GitHub Profile
(sudo) gem install bolide-client
.field
%label Email
%input{:type=>"text"} email@domain.com
nameLabel: SC.LabelView.design({
layout: { top: 5, height: 24, left: 5, right: 0},
value: "Email",
controlSize: SC.LARGE_CONTROL_SIZE,
fontWeight: SC.BOLD_WEIGHT
}),
titleLabel: SC.FieldView.design({
layout: { top: 5, height: 24, left: 90, right: 0},
valueBinding: "Ccube.contactObjectController.email",
})
$('#resources.button').popover({header: "#resources-header", content: "#resources-content"});
@juggy
juggy / Country and States.js
Created November 10, 2010 03:21
Collect country codes, names and states from yahoo geolocation service with underscore.js and jquery
window.Countries = {};
$.ajax({
url: "http://where.yahooapis.com/v1/countries",
data: {appid: "5mCqm._V34HyJ7CniyiCQq.oi8LjlbUnJ1ge4X36P9bpyyao2ey7xvS.mBb1jcAf69AzoQ--", format: "json"},
dataType: "json",
success: function(data){
var countries = _.map(data.places.place, function(country){
return {"name": country.name, "url": country.uri};
})
ActionController::Base.asset_host = Proc.new { |source, request|
if request.env["REQUEST_PATH"].include? ".pdf"
"file://#{Rails.root.join('public')}"
else
"#{request.protocol}#{request.host_with_port}"
end
}
@juggy
juggy / gist:797100
Created January 26, 2011 17:49
Html5 parse error
<div class='template' id='expense_line_template'>
<form accept-charset="UTF-8" action="" class="formtastic expense_line" id="new_expense_line" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="Oebai47Bo8n5KjXRi37Z+nK9vJkWI3bxtwgIpc5Hjqg=" /></div>
<fieldset class="inputs"><ol><li class="numeric required material" id="expense_line_material_id_input"><label for="expense_line_material_id">Material<abbr title="required">*</abbr></label><input id="expense_line_material_id" name="expense_line[material_id]" type="text" /></li>
<li class="select required expense_category" id="expense_line_expense_category_input"><label for="expense_line_expense_category_id">Category<abbr title="required">*</abbr></label><select id="expense_line_expense_category_id" name="expense_line[expense_category_id]"><option value="1">Material</option>
<option value="2">Subcontractor</opt
@juggy
juggy / call_template.rb
Created May 17, 2011 19:25
Render a complete page in rails 3 without controller
# create the template
template = PageOfflineTemplate.new
template.quote = quote
template.pages = quote.build_pages
# Here I render a template with layout to a string then a PDF
pdf = PDFKit.new template.render_to_string(:template=>"quotes/review.html.haml")
@juggy
juggy / gist:1023110
Created June 13, 2011 16:25
Revert to last saved version using Backbone.js
Skepic.EventedModel = Backbone.Model.extend
initialize: ->
Backbone.Model.prototype.initialize.apply(@, arguments)
_.bindAll(@, "mark_to_revert", "revert")
@mark_to_revert()
save : (attrs, options)->
self = this
options || (options = {})
@juggy
juggy / gist:1156873
Created August 19, 2011 14:06
Patched Ruby 1.9.2 for faster load and GC
cd /tmp
# Faster require:
# https://gist.github.com/1008945
curl -O https://raw.github.com/gist/1008945/4edd1e1dcc1f0db52d4816843a9d1e6b60661122/ruby-1.9.2p290.patch
# GC-tuning:
# https://gist.github.com/856296
curl -O https://raw.github.com/gist/856296/a19ac26fe7412ef398bd9f57e61f06fef1f186fe/patch-1.9.2-gc.patch