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
/** | |
* i have an idea. | |
* | |
* Background: | |
* | |
* The flow was designed at first to encompass all flow control, loops and | |
* branches, etc. later during Cursed development, I had the idea to simplify | |
* some types of flow control where a single action was completely "embedded" | |
* within another. I called these "follow-ups". They used a simple mechanism | |
* where at any point during the execution of a player action, you could call |
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 FormContainer extends React.Component { | |
componentWillMount() { | |
this.props.fetchForm(); | |
} | |
render() { | |
<MyForm onChange={this.props.updateForm}/> | |
<Submit onClick={this.props.submitForm}/> | |
} | |
} |
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
// list_app.js | |
Slick = require('slick'); | |
listItem = require('./data/list_item'); | |
list = require('./data/list'); | |
var MyListApp = module.exports = new Slick.App({ | |
// init is called by the node after node starts up and hits addApplication which propagates the Node reference on this.node | |
init: function() { | |
// we register our data type containing field info and any custom logic | |
this.addModel('listItem', listItem); |
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 Q = require('../game.js'); | |
describe("Q", function() { | |
var game; | |
beforeEach(function() { | |
game = new Q.Game(); | |
}); |
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
hearts = new Game(); | |
var cards = new Pieces(['2C',]).attributes({ | |
suit: hearts.suitOf, | |
value: hearts.valueOf, | |
points: hearts.pointsOf | |
}); | |
hearts.deck = new Space({cards: cards}); | |
hearts.players = new Players(4).attributes({ |
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
gem 'activerecord', '3.2.13' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
require 'debugger' | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) |
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 Fixnum | |
def factors | |
(1..self).select { |f| modulo(f) == 0 }.uniq | |
end | |
def prime? | |
equal? 1 or factors == [1, self] | |
end | |
def coprime?(b) |
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
# long-hand create routes directly | |
path 'users' do | |
get { User.all } | |
post { User.create params } | |
var (/\d/) do |id| | |
get { User.find(id) } | |
... | |
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
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> | |
<div id="map" style="position:relative"> | |
<img src="http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=2&scale=2&size=640x400&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.714728,-76.211794&markers=color:green%7Clabel:G%7C42.922217,-76.211794&markers=color:red%7Ccolor:red%7Clabel:C%7C42.922217,-73.998672&sensor=false"> | |
</div> | |
<script> | |
mapToCoord(42.922217,-73.998672, 40.714728, -73.998672, 6, 2, 640, 400, 'red'); |