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
def apply_coupons | |
applied_coupons = [] | |
active_coupons = family.family_coupons.active.order(:created_at).map(&:coupon).flatten | |
total = self.subtotal | |
while !total.zero? && !active_coupons.empty? | |
active_coupons.filter { |c| c.coupon_type == "permanent_percent" }.each do |coupon| | |
total = total * coupon.amount / 100.0.to_i | |
applied_coupons.push(coupon) | |
active_coupons -= [coupon] | |
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
/* ASDFPixelSort for video frames v1.0 | |
Original ASDFPixelSort by Kim Asendorf <http://kimasendorf.com> | |
https://github.com/kimasendorf/ASDFPixelSort | |
Fork by dx <http://dequis.org> and chinatsu <http://360nosco.pe> | |
Randomization modifications by Dan-O | |
-- Usage: | |
1. Split a video into a series of pictures with ffmpeg: | |
$ ffmpeg -i "input.mov" -an -f image2 "frame_%06d.png" | |
2. Change `String basedir` in this script to point to where the images are located. | |
3. Tweak things, that's what's most fun, isn't it? |
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
#!/usr/bin/env node | |
'use strict'; | |
var realist = require('realist'), | |
fs = require('fs'), | |
colors = require('colors'), | |
read = require('fs').readFileSync, | |
join = require('path').join, | |
_ = require('lodash'), |
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
pm http GET https://registry.npmjs.org/npm | |
npm http 304 https://registry.npmjs.org/npm | |
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm' | |
npm ERR! error rolling back [email protected] { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm'] | |
npm ERR! error rolling back errno: 3, | |
npm ERR! error rolling back code: 'EACCES', | |
npm ERR! error rolling back path: '/usr/local/lib/node_modules/npm' } | |
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm' | |
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm'] | |
npm ERR! errno: 3, |
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
novafabricaGlobalSearch = { | |
searchField: null, | |
searchListContainer: null, | |
list: null, | |
searchUrl: null, | |
autoCompleteVars: null, | |
_createAutoList: function(json) { | |
var self = novafabricaGlobalSearch; |
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 stream = require('stream'); | |
var liner = new stream.Transform( { objectMode: true } ); | |
liner._buffer = ''; | |
liner._transform = function (chunk, encoding, done) { | |
var self = this; | |
var data = chunk.toString(); | |
this._buffer = this._buffer + data | |
done(); |
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
http://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ | |
http://blog.cloudflare.com/cloudflare-prism-secure-ciphers |
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
require 'mogli' | |
module FacebookIntegrationHelpers | |
shared_context "with unconnected facebook user" do | |
let(:fb_user) { create_test_user(installed: false) } | |
after { fb_user.destroy } | |
end | |
def app_client | |
Mogli::AppClient.new(AppConfig.facebook.access_token, AppConfig.facebook.app_id) |
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 Robot = function(robot){ | |
robot.turnLeft(robot.angle % 90); | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
if (robot.parentId) { | |
robot.ahead(1); | |
robot.turnGunRight(1); | |
} | |
else { |
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 Robot = function(robot){ | |
robot.turnLeft(robot.angle % 90); | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
if (robot.parentId) { | |
robot.ahead(1); | |
robot.turnGunRight(1); | |
} | |
else { |
NewerOlder