I hereby claim:
- I am muffs on github.
- I am muffs (https://keybase.io/muffs) on keybase.
- I have a public key whose fingerprint is CC12 CABA 54A4 E437 B21D CB4E A1CA 4E4D 7C49 EE2B
To claim this, I am signing this object:
| # ensures that your models return with the same ordering as ids | |
| # e.g., [1,2,3] yields [<YourModel id=1>, <YourModel id=2>, <YourModel id=3>] | |
| # via: https://gist.github.com/cpjolicoeur/3590737, brilliant solution | |
| values = ids.each_with_index.map { |id, index| "(#{id}, #{index + 1})" }.join(",") | |
| YourModel.unscoped.where(id: ids).joins("join (VALUES #{values}) as x(id, ordering) ON listings.id = x.id").order("x.ordering") |
| class Rack::Attack | |
| CLOUDFLARE_SUBNETS = [ | |
| IPAddr.new("103.21.244.0/22"), | |
| IPAddr.new("103.22.200.0/22"), | |
| IPAddr.new("103.31.4.0/22"), | |
| IPAddr.new("104.16.0.0/12"), | |
| IPAddr.new("108.162.192.0/18"), | |
| IPAddr.new("131.0.72.0/22"), | |
| IPAddr.new("141.101.64.0/18"), |
| # NOTE: need to override Devise's Trackable `update_tracked_fields` when using CloudFlare & Heroku. | |
| def update_tracked_fields(request) | |
| super | |
| # NOTE: need to pull the first IP out of a list of IPs since Heroku | |
| # will append CloudFlare's IP. | |
| old_current = self.current_sign_in_ip | |
| new_current = if request.headers["X-Forwarded-For"].present? | |
| request.headers["X-Forwarded-For"][/[0-9\.]+/] | |
| else |
| function User(firstName, lastName) { | |
| this.firstName = firstName; | |
| this.lastName = lastName; | |
| } | |
| User.prototype.fullName = function() { | |
| return this.firstName + ' ' + this.lastName; | |
| } | |
| userObjects.each(function(user) { |
I hereby claim:
To claim this, I am signing this object:
| /** @jsx React.DOM */ | |
| define([ | |
| 'react', | |
| ], function(React) { | |
| var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; | |
| var TestableCSSTransitionGroup = React.createClass({ |
| var ExampleComponent = React.createClass({ | |
| getInitialState: function() { | |
| return { | |
| shouldDisplayElement: true | |
| } | |
| }, | |
| toggle: function() { |
| _hydrate: function() { | |
| var args = arguments; | |
| var keys = _.keys(this.requires); | |
| var values = _.values(this.requires); | |
| /** | |
| * Create a list of promises. | |
| */ | |
| var promises = values.map(function(fn) { | |
| return fn.apply(this, args); |
| #!/usr/bin/env node | |
| var q = require('q'); | |
| var exec = require('child_process').exec; | |
| var exit = process.exit; | |
| var fs = require('fs'); | |
| var readline = require('readline'); | |
| var grep = function(pattern) { | |
| var dfd = q.defer(); |
| q.all([only(), debug()]) | |
| .then(flatten) | |
| .then(function(lines) { | |
| var dfd = q.defer(); | |
| var rl = readline.createInterface({ | |
| input: process.stdin, | |
| output: process.stdout | |
| }); | |
| rl.question(lines[0] + ' -- is this cool? (n)o , (y)es >', function(answer) { |