This file contains hidden or 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
// | |
// The logic here is the transitionend event fires instantly | |
// after the transition is done (1ms here). I have seen timeouts | |
// taking up to 300ms to fire (!) so the main avantage is responsiveness. | |
// | |
window.requestTimeout = (function(){ | |
var vendors = 'Webkit Moz O ms Khtml'.split(' '), | |
supports = (function() { | |
var div = document.createElement('div'), | |
len = vendors.length; |
This file contains hidden or 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
Ember.ActiveState = Ember.LayoutState.extend | |
isActive: false | |
enter: (manager, transition)-> | |
@_super(manager, transition) | |
@set("isActive", true) | |
exit: (manager, transition)-> | |
@_super(manager, transition) | |
@set("isActive", false) |
This file contains hidden or 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
- content_for :scripts do | |
= javascript_include_tag "app/application" | |
= javascript_include_tag "app/templates/all" | |
:javascript | |
S.set("quote", S.store.find(S.models.Quote, S.store.load(S.models.Quote, #{QuoteSerializer.new(Quote.find(params[:id])).to_json}.quote).id)); | |
console.log("data loaded") | |
- content_for :sidebar do | |
%script{type:"text/x-handlebars"} | |
{{view S.views.SidebarView}} |
This file contains hidden or 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
I have: | |
Skepic.DashPlot = Backbone.View.extend | |
... | |
But want (dash_plot is a precreated object): | |
((dash_plot)-> | |
dash_plot.extend Backbone.View, | |
... |
This file contains hidden or 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
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 |
This file contains hidden or 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
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 = {}) |
This file contains hidden or 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
# 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") | |
This file contains hidden or 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
<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="✓" /><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 |
This file contains hidden or 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
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 | |
} |
This file contains hidden or 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
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}; | |
}) |