Skip to content

Instantly share code, notes, and snippets.

@kfatehi
kfatehi / ruby19p187
Created December 10, 2012 09:42
Datetime difference in p327 v p193
# in ruby19p193 (on mac) we get the expected behavior
[9] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> right['created_at']
=> Mon, 10 Dec 2012 09:32:21 UTC +00:00
[10] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> left['created_at']
=> Mon, 10 Dec 2012 09:32:21 UTC +00:00
[11] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> right['created_at'] == left['created_at']
=> true
@kfatehi
kfatehi / gist:4250570
Created December 10, 2012 13:30
missing template in production
Started GET "/users/sign_in" for 64.183.63.90 at 2012-12-10 05:30:15 -0800
Processing by SessionsController#new as HTML
Completed 500 Internal Server Error in 2ms
ActionView::MissingTemplate (Missing template layouts/devise_layout with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder]}. Searched in:
* "/home/keyvan/caps/app/views"
* "/usr/local/lib/ruby/gems/1.9.1/gems/devise-2.1.2/app/views"
):
@kfatehi
kfatehi / gist:4250607
Created December 10, 2012 13:38
Gemfile
source :rubygems
gem 'rails', '3.2.8'
gem 'puma'
gem 'sqlite3'
gem 'haml-rails'
group :assets do
gem "coffee-rails"
@kfatehi
kfatehi / jekyll-import-tumblr.rb
Created May 12, 2013 02:14
Jekyll Tumblr Import using jekyll-import v0.1.0.beta1
#!/usr/bin/env ruby
require 'rubygems'
##
# Monkeypatch to fix the following
# tumblr.rb:73
# content = post.at["audio-player"] + "<br/>" + post["audio-caption"]
class Hash
def at
@kfatehi
kfatehi / README.md
Last active December 18, 2015 20:28 — forked from joelverhagen/README.md

This is a plugin meant for Jekyll.

Example use:

Easily embed a YouTube video. Just drop this file in your _plugins directory.

{% youtube oHg5SJYRHA0 %}
execve("/usr/bin/apt-get", ["apt-get", "update"], [/* 20 vars */]) = 0
brk(0) = 0x2129000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f412f395000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=16136, ...}) = 0
mmap(NULL, 16136, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f412f391000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
@kfatehi
kfatehi / README.md
Last active December 19, 2015 18:58
Testing to see if we can blit from video to canvas and then extract pixel data in a CORS compliant way

So far it seems to me that CORS isn't properly implemented on the video tag on all browsers in that they still taint the canvas when blitted, preventing further extraction ... Or I'm doing something wrong.

Notes

The video source is 192.168.0.206/strawberries.mp4 -- my setup is an IIS 8 server set up at that URL with an h264 mp4 video

IIS CustomHeaders Documentation

http://www.iis.net/configreference/system.webserver/httpprotocol/customheaders

@kfatehi
kfatehi / gist:6102039
Created July 29, 2013 03:46
rough outline of github workflow tutorial screencast
Github/Tmux/Vim Collab Workflow Demo
Record Jeanre's and my own screen as we develop some software together
1 Create a new gem locally
bundle gem <name>
2 Create a new repository on Github and upload the gem
3 Create a milestone together with semantic versioning
4 Add jeanres as a collaborator
5 Jeanre will explore the issue tracker and notice a milestone
#!/usr/bin/env ruby
ENV['RACK_ENV'] = 'production'
require 'rubygems'
require 'bait/cli'
Bait::CLI.send case ARGV[0] || "server"
when "server"
:serve
when "test"
@kfatehi
kfatehi / server.rb
Created August 4, 2013 06:02
Rack app to dump environment
#!/usr/bin/env ruby
require 'rubygems'
require 'rack'
class RequestDump
def call(env)
html = "<html><body>"
env.each do |key,val|
html << "<p>Key: #{key}<br>"
html << " Value: #{val}</p>"