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
// Not tested, but the main gist of glueing ampersand state and react components together well. The actual mixin I use in production is slightly more eleborate (handling the stopping of listening and rebinding through the component's lifecycle), but the main idea is there. | |
var Events = require('backbone-events-standalone'), | |
React = require('react'), | |
State = require('ampersand-state'); | |
var PostModel = State.extend({ | |
props: { | |
title: 'string', | |
body: 'string' |
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
Warden::Manager.serialize_into_session{|user| user.id } | |
Warden::Manager.serialize_from_session{|id| User.get(id) } | |
Warden::Manager.before_failure do |env,opts| | |
# Sinatra is very sensitive to the request method | |
# since authentication could fail on any type of method, we need | |
# to set it for the failure app so it is routed to the correct block | |
env['REQUEST_METHOD'] = "POST" | |
end | |
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
IterableCollection = Backbone.Collection.extend({ | |
initialize: function() { | |
//_.bindAll(this, ) | |
this._resetIndexes(); | |
}, | |
_resetIndexes: function() { | |
this.currentIndex = 0; | |
this.hasSelection = false; | |
}, | |
parse: function(response) { |
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
#include <SPI.h> | |
#include <Ethernet.h> | |
// Enter a MAC address and IP address for your controller below. | |
// The IP address will be dependent on your local network: | |
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; | |
byte ip[] = { 192,168,1,3 }; | |
byte server[] = { 192,168,1,2 }; | |
String request = "GET /ping?q=123 HTTP/1.0"; |
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
requiredUsers = new UserDataVOFilter(allUsers) | |
.onlyManagers() | |
.withCompanyKey(3) | |
.withStatus(UserStatus.STAFF) | |
.data; |
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 Jekyll | |
class Pagination < Generator | |
# This generator is safe from arbitrary code execution. | |
safe true | |
# Generate paginated pages if necessary. | |
# | |
# site - The Site. | |
# |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<scheme name="BlueForestDev" version="1" parent_scheme="Default"> | |
<option name="LINE_SPACING" value="1.1" /> | |
<option name="EDITOR_FONT_SIZE" value="12" /> | |
<option name="EDITOR_FONT_NAME" value="Menlo" /> | |
<colors> | |
<option name="ADDED_LINES_COLOR" value="8080" /> | |
<option name="ANNOTATIONS_COLOR" value="8080ff" /> | |
<option name="ANNOTATIONS_MERGED_COLOR" value="80ff80" /> | |
<option name="CARET_COLOR" value="ffffff" /> |
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 GenerateImageThumbnailsJob < Struct.new(:photo_id) | |
def perform | |
photo = Photo.find(photo_id) | |
photo.medium_image = photo.image.thumb('940x600') | |
photo.large_image = photo.image.thumb('450x') | |
photo.small_image = photo.image.thumb('172x167#c') | |
photo.save | |
end |
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
before: | |
command: rbenv install 1.9.3-p362 | |
output: ruby-build: definition not found: 1.9.3-p362 | |
hack: | |
command: brew unlink ruby-build | |
output: Unlinking /usr/local/Cellar/ruby-build/20121120... 4 links removed | |
command: brew update |
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
var httpProxy = require('http-proxy'), | |
staticDir = 'app', | |
apiHost = '<Your API Host>', | |
apiPort = 80, | |
apiPath = '/api'; | |
var proxy = new httpProxy.RoutingProxy(); | |
connect() | |
.use(connect.logger("dev")) | |
.use(function (req, res, next) { |
OlderNewer