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
task :sync_tables => :environment do | |
ActiveRecord::Base.connection.tables.each do |table| | |
unless ['schema_migrations', 'ar_internal_metadata'].include?(table) | |
sql = "SELECT setval('#{table}_id_seq', COALESCE((SELECT MAX(id)+1 FROM #{table}), 1), false);" | |
ActiveRecord::Base.connection.execute(sql) | |
end | |
end | |
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
var Input = React.createClass({ | |
propTypes: { | |
type: React.PropTypes.string, | |
label: React.PropTypes.string, | |
help: React.PropTypes.string, | |
className: React.PropTypes.string | |
}, | |
renderInput: function() { | |
switch(this.props.type) { |
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
# your-engine/lib/magic/rails/engine.rb | |
module Magic | |
module Rails | |
module Engine | |
## | |
# Automatically append all of the current engine's routes to the main | |
# application's route set. This needs to be done for ALL functional tests that | |
# use engine routes, since the mounted routes don't work during tests. | |
# |
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
jQuery.fn.autoresize = function (options) { | |
options = options || {} | |
return this.each(function () { | |
// Init Sizes | |
var parent = $(this).parent(); | |
var imageWidth = $(this).width(); | |
var imageHeight = $(this).height(); | |
var parentWidth = parent.width(); | |
var parentHeight = parent.height(); | |
var ratio, newSide; |
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
class UsersController < ApplicationController | |
def index | |
@users = User.all | |
respond_to do |format| | |
format.html # renders index.html.erb | |
format.json { render :json => @users } | |
format.xml { render :xml => @users } | |
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
@mixin module{ | |
background: white; | |
border: 1px solid #ccc; | |
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1); | |
} | |
#content { | |
@include module; | |
float: left; | |
} |
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
# Creates a Bootstrap dropdown | |
# Ex: | |
# = dropdown_to "Auctions", auctions_path do | |
# %li= link_to 'Upcoming Auctions', auctions_path | |
# %li= link_to 'Past Auctions', past_auctions_path | |
# | |
# Returns: | |
# <li class="dropdown"> | |
# <a class="dropdown-toggle" data-toggle="dropdown" href="/auctions"> | |
# <span>Auction</span> |
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
class Person | |
def initialize(food = 0) | |
@next_feeding_time = Time.now | |
feed(food) | |
end | |
def hungry? | |
@next_feeding_time < Time.now | |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{QUERY_STRING} !ajax | |
RewriteRule ^(.*)$ /#/$1 [R=301,L,NE] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d |
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
var colorObject; | |
var hexes = ['5b7f52', '6ea041', '62a04a', '5b7f52', '6cb84e']; | |
var colors = []; | |
for (var h = 0; h < hexes.length; h++) { | |
colorObject = new SolidColor(); | |
colorObject.rgb['hexValue'] = hexes[h]; | |
colors.push(colorObject); | |
} |
NewerOlder