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
import Component from '@ember/component'; | |
import { computed } from '@ember/object'; | |
import { later, next } from '@ember/runloop'; | |
import $ from 'jquery'; | |
const TEMP_DELAY = 3000; | |
const SLIDE_DELAY = 300; | |
const FADE_IN_DELAY = SLIDE_DELAY * 1.3; | |
const FADE_OUT_DELAY = SLIDE_DELAY * 0.7; |
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
let Vue | |
export default class I18nPlugin { | |
constructor(options) { | |
this.locale = options.locale | |
this.fallbackLocale = options.fallbackLocale | |
this.messages = options.messages | |
this.pluralizers = options.pluralizers | |
this.subscribers = [] | |
this.silentTranslationWarn = false |
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
// helpers | |
/////////////////////////////////// | |
function bench(fn) { | |
var t0 = new Date().getTime(), | |
res = fn(); | |
console.log("Time: ", new Date().getTime() - t0); | |
return res; | |
} |
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
Gfx = (function(window) { | |
var document = window.document; | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext('2d'); | |
var helpers = { | |
hyp: function(x0, y0, x1, y1) { | |
return Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)); | |
}, | |
sign: function(value) { |
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 'sinatra' | |
get '/' do | |
erb :index | |
end | |
get '/iframe' do | |
erb :iframe | |
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
(function (window, checkNode){ | |
var p = {}; | |
var m = { | |
registerObserver: function() { | |
if (typeof(window.WebKitMutationObserver) == "undefined") return; | |
p.observer = new window.WebKitMutationObserver(function(mutationRecords) { | |
mutationRecords.forEach(function(mutationRecord) { | |
for (var i = 0; i < mutationRecord.addedNodes.length; ++i) |
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
# | |
# requires: | |
# a) run https://gist.github.com/2022231 on localhost:3001 | |
# b) provide a streamed.jpg at script location | |
# | |
# result: | |
# this fails for em-http-request v1.0.1 | |
# | |
require "rubygems" |
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 'goliath' | |
require 'base64' | |
class StreamingEchoedImageService < Goliath::API | |
def on_headers(env, headers) | |
env.logger.info "#{env['REQUEST_METHOD']} #{env['REQUEST_URI']}" | |
env.logger.info 'received headers: ' + headers.inspect | |
env['async-headers'] = headers | |
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
class Timer | |
attr_reader :diff, :sum, :step | |
def initialize | |
reset! | |
end | |
def mark! | |
new_mark = now |