Skip to content

Instantly share code, notes, and snippets.

View tylr's full-sized avatar

Tyler Love tylr

View GitHub Profile
isPortrait = (
imgAspect > windowAspect
|| (
img.naturalWidth > window.innerWidth
&&
img.naturalHeight < window.innerHeight
)
);
@tylr
tylr / gist:a5ae2c90de0958991bd1
Created July 16, 2014 05:59
Parse Raw Voyager 1 and 2 Pulse Wave Spectrum Analyzer DAT files
require 'pry'
require 'pry-byebug'
require 'date'
require 'json'
def raw_samples
format = 's7c2s16'
samples = []
open('./sample2.dat', 'rb') do |file|
redis-cli KEYS *rails-cache* | xargs redis-cli DEL
class BustleModel < Ohm::Model
include ActiveModel::Validations
def save
return false unless valid?
super
end
end
class Channel < BustleModel
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client();
var eventPattern = /([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) \"(.*?)\" \"(.*?)\" \"(.*?)\" \"(.*?)\" \"(.*?)\"/;
exports.handler = function(data, context) {
var events = [];
var encodedEvent, rawEvent,
matchedEvent, event, i,
commands;
module ShitCan
require 'memcached'
def self.load(con_path='localhost:11211')
@cache = Memcached.new(con_path)
end
def self.cache
if @cache
return @cache
# Your Controller
def some_controller_action
ShitCan.skip_if_exists("#{params[:id]}_save_me") do
@blah = User.find_by_login(params[:id])
@items = Ass.timeline(@dj.id.to_s)
@items.some_cpu_heavy_command
end
end
module API
def self.has_access?(token)
network = const_get token.for
network.has_access? token.key, token.secret
end
def display_files(files, token)
network = const_get token.for
network.display_files files, token.key, token.secret
end
PP.Rotator = function(){
_rotator = {
_opts: {
interval: 5,
rotate: function(){}
},
_timer: null,
start: function(){
[user]
name = Tyler Love
email = github@tylr.org
[core]
editor = mate -w
excludesfile = /Users/tylr/.gitignore
[color]
diff = auto
branch = auto