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 ActiveRecord::Base | |
def self.import!(record_list) | |
raise ArgumentError "record_list not an Array of Hashes" unless record_list.is_a?(Array) && record_list.all? {|rec| rec.is_a? Hash } | |
return record_list if record_list.empty? | |
(1..record_list.count).step(1000).each do |start| | |
key_list, value_list = convert_record_list(record_list[start-1..start+999]) | |
sql = "INSERT INTO #{self.table_name} (#{key_list.join(", ")}) VALUES #{value_list.map {|rec| "(#{rec.join(", ")})" }.join(" ,")}" | |
self.connection.insert_sql(sql) |
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
{{#liquid-with model}} | |
<h1>{{title}}</h1> | |
<div class="col-md-9"> | |
<img {{bind-attr src=image_big}} class="img-responsive" alt="Logo" /> | |
<p><strong>{{teaser}}</strong></p> | |
<p>{{{text}}}</p> | |
</div> | |
<div class="col-md-3"> |
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
App.MapsView = Ember.View.extend({ | |
didInsertElement: function() { | |
var mapOptions = { | |
zoom: 12, | |
disableDefaultUI: true, | |
center: new google.maps.LatLng(52.50143, 13.402521), | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
} | |
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); | |
}, |
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
Gerrit-Wanderers-iMac:rails_template gerrit$ guard | |
Guard is now watching at '/Users/gerrit/Workspace/rails_template' | |
Starting Spork for RSpec | |
Using RSpec | |
Preloading Rails environment | |
Loading Spork.prefork block... | |
Spork is ready and listening on 8989! | |
Spork server for RSpec successfully started | |
Guard::RSpec is running, with RSpec 2! | |
Running all specs |
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
jQuery(document).ajaxSend(function(event, request, settings) { | |
request.setRequestHeader("Accept", "text/javascript"); | |
request.setRequestHeader("X-Requested-With", "XMLHttpRequest"); | |
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); | |
if (settings.type.toUpperCase() == 'GET' || typeof(AUTH_TOKEN) == "undefined") return; | |
settings.data = settings.data || ""; | |
// And here we're setting the authenticity_token for Rails. Of course you've actived protect_from_forgery, right? | |
if (typeof(AUTH_TOKEN) != "undefined") settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN); | |
}); |
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
<%= stylesheet_link_tag("stylesheets/#{@controller.controller_name}") if File.exist?("stylesheets/#{@controller.controller_name}.css") %> | |
# And If you are using SCSS, just point the path to your compiled CSS files. | |
# In my case I compile styesheets into /tmp/stylesheets/compiled/*.css | |
# This is currently the only way to get SCSS/COMPASS working on heroku. | |
<%= stylesheet_link_tag("compiled/#{@controller.controller_name}") if File.exist?("tmp/stylesheets/compiled/#{@controller.controller_name}.css") %> |
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
module Netzke | |
module Railz | |
class Engine < Rails::Engine | |
config.netzke = Netzke::Core::OptionsHash.new | |
# before loading initializers and classes (in app/**) | |
config.before_initialize do | |
Netzke::Core.config = config.netzke | |
Netzke::Core.ext_location = Rails.root.join("public", "extjs") | |
Netzke::Core.touch_location = Rails.root.join("public", "sencha-touch") |