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
module.exports = { | |
entry: './example/main.js', | |
output: { | |
filename: './build/bundle.js' | |
}, | |
module: { | |
loaders: [ | |
{test: /\.js$/, loader: 'jsx-loader'} | |
] | |
} |
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
require 'net/http' | |
class Avatar | |
attr_accessor :email, :response | |
def initialize(email) | |
@email = email | |
end | |
def self.default_urls |
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
App.Router.map -> | |
@resource 'schedules', -> | |
@resource 'schedule', { path: '/:schedule_id' }, -> | |
@resource 'events' | |
App.EventsRoute = Ember.Route.extend | |
model: -> | |
@modelFor('schedule').get('events') | |
App.Schedule = DS.Model.extend |
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 API::BaseController < ApplicationController | |
respond_to :json | |
before_action :set_default_format, :assert_valid_format!, :authenticate_from_token!, :authenticate_client! | |
protected | |
def authenticate_from_token! | |
token = request.headers['X-Authentication-Token'] | |
id = request.headers['X-Authentication-Id'] |
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
namespace :app do | |
desc "Build static distrubution" | |
task :build do | |
puts "Building..." | |
# Shell out for now... | |
`bundle exec rake assets:clean` | |
puts "Compiling" | |
`bundle exec rake assets:precompile` | |
puts "Starting web get" |
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
-(void)animateButton:(UIButton *)sender | |
{ | |
CGRect originalFrame = sender.frame; | |
CGRect newFrame = CGRectMake(originalFrame.origin.x - 3, originalFrame.origin.y - 3, originalFrame.size.width + 6, originalFrame.size.height + 6); | |
[UIView animateWithDuration:0.4 delay:0 options:(UIViewAnimationOptionAutoreverse) | |
animations:^{ | |
sender.frame = newFrame; | |
} | |
completion:^(BOOL finished){ |
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
def pending_changes? | |
return false if !status.published? | |
original_attributes = Product.last.attributes.symbolize_keys.except(*publish_excluded_attributes) | |
published_attributes = Product.last.published_record.attributes.symbolize_keys.except(*publish_excluded_attributes) | |
original_attributes == published_attributes ? false : update_attribute(:published_status, 'changed') | |
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
# Delegate in a block to set up multiple delegations | |
with_options allow_nil: true do |product_delegate| | |
product_delegate.delegate :fields, to: :product_type | |
end | |
# Delegate as a method call | |
delegate :fields, to: :product_type, allow_nil: true |
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
// Should be used to modify the default spacing between objects (not between nodes of * the same object) | |
// p,m = padding,margin | |
// a,t,r,b,l,h,v = all,top,right,bottom,left,horizontal,vertical | |
// x,s,m,l,n = extra-small($x),small($s),medium($m),large($l),none(0px) | |
$x: 3px; | |
$s: 5px; | |
$m: 10px; | |
$l: 20px; | |
.ptn, .pvn, .pan { |
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
self.markdownable_columns.each do |markdown_column| | |
define_method :"#{markdown_column}_html" do | |
if value = send(markdown_column) | |
<Application>::Application.config.markdown_renderer.render(value).html_safe | |
end | |
end | |
end |