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
source :rubygems | |
gem 'mongoid' |
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
map = ()-> | |
return unless @a? #skip things with no actions array | |
return unless @i? | |
time = @_id.getTimestamp().getTime() | |
hour = time / 1000 / 3600 | |
cst = hour - 6 | |
key = parseInt(cst / 24).toString() + "-" + hex_md5(@i.join('-')) | |
val = {actions : {}, ids : @i, time : time} | |
for a in @a | |
val.actions[a] = 1 |
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 TrackingMiddleware | |
attr_accessor :app | |
def initialize(app) | |
self.app = app | |
end | |
def call(env) | |
if env["PATH_INFO"] == '/tracker' | |
req = Rack::Request.new(env) | |
p = req.params.select{|k,v| TrackingWorker::FIELDS.has_key?(k) } |
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
#!/bin/bash | |
SHADOW_FILE="/etc/shadow" | |
DATE=$(( $(date -u '+%s') / 60 / 60 / 24 )) | |
REPLACEMENT=$(echo "account-$1:$2:$DATE:0:99999:7:::" | sed -e 's/\(\/\|\\\|&\)/\\&/g') | |
sed -i "s/^account-$1:.*$/$REPLACEMENT/" $SHADOW_FILE \ | |
&& echo "success" |
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 :credibles do | |
desc "Pre compiles assets" | |
task :deploy => ['credibles:prep_heroku', 'assets:compile', 'credibles:push_heroku'] | |
task :prep_heroku do | |
puts "Switching to staging branch...\n" | |
system "git checkout -b staging || git checkout staging" | |
puts "Checking heroku remote...\n" | |
system 'git remote add heroku [email protected]:credibles.git || echo "remote exists"' | |
puts "Pulling down heroku changes...\n" | |
system 'git pull heroku master' |
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
var stitch = require('stitch'); | |
var express = require('express'); | |
var package = stitch.createPackage({ | |
paths: [__dirname + '/lib'], | |
identifier : 'credibles' | |
}); | |
var app = express.createServer(); | |
app.configure(function(){ |
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
var credibles = (function(modules) { | |
var exportCache = {}; | |
return function require(name) { | |
var module = exportCache[name]; | |
var fn; | |
if (module) { | |
return module; | |
} else if (fn = modules[name]) { | |
module = { id: name, exports: {} }; | |
fn(module.exports, require, module); |
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
.button, input[type=submit], input[type=button]{ | |
border: 0px; | |
margin: 0px; | |
color: white; | |
font-size: 12px; | |
padding: 5px 12px; | |
vertical-align: middle; | |
text-align: center; | |
text-decoration: none; | |
font-weight: bold; |
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
copypasta.locate_text_container = function() { | |
var biggest, biggest_count, p, parent, parent_count, _i, _len, _ref; | |
parent = false; | |
biggest = false; | |
biggest_count = 0; | |
parent_count = 0; | |
_ref = document.getElementsByTagName('p'); | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
p = _ref[_i]; | |
if (p != null) { |
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
copypasta.locate_text_container = ()-> | |
parent = false | |
biggest = false | |
biggest_count = 0 | |
parent_count = 0 | |
for p in document.getElementsByTagName('p') when p? | |
if parent != p.parentElement | |
if parent_count > biggest_count | |
biggest_count = parent_count | |
biggest = parent |