Skip to content

Instantly share code, notes, and snippets.

View dinks's full-sized avatar

Dinesh Vasudevan dinks

View GitHub Profile
@dinks
dinks / pcip.js
Last active August 29, 2015 14:09
Parasitic Combination Inheritance Pattern
Object.create = function(o) {
function F() {};
F.prototype = o;
return new F();
};
var inheritP = function(child, parent) {
parentDup = Object.create(parent.prototype);
parentDup.constructor = child;
child.prototype = parentDup;
@dinks
dinks / module_export.js
Created November 15, 2014 15:31
Module and Export
var module = {
exports: {}
};
// If you require a module, it's basically wrapped in a function
(function(module, exports) {
exports = function (n) { return n * 1000 };
}(module, module.exports))
console.log(module.exports); // it's still an empty object :(
@dinks
dinks / mds_check.sh
Created November 12, 2014 10:29
mds Check
# mds is the spotlight index worker
# you could see what it indexes using this command
# http://blog.bm5k.com/2012/05/02/dont-index-your-database/
sudo fs_usage -w -f filesys mdworker | egrep "open"
require 'net/http'
require 'xmlsimple'
url = "http://www.user-agents.org/allagents.xml"
xml_data = Net::HTTP.get_response(URI.parse(url)).body
data = XmlSimple.xml_in(xml_data)
agents = data['user-agent'].select{|agent| type = agent["Type"].first; type.include?("R") || type.include?("S")}
agent_names = agents.collect {|agent| agent["String"].first}
@dinks
dinks / Demo-Flexbox-1.markdown
Created September 24, 2014 13:39
A Pen by Dinesh Vasudevan.
@dinks
dinks / spec_helper.rb
Created September 23, 2014 11:57
Sidekiq run asynchronously
Sidekiq::Testing.inline! # Run async worker jobs synchronous
@dinks
dinks / bin_load.rb
Created August 18, 2014 09:49
Load Bin Dynamically
load Gem.bin_path('rspec-core', 'rspec')
@dinks
dinks / iebuc.markdown
Created July 29, 2014 17:54
A Pen by Dinesh Vasudevan.
@dinks
dinks / i18n_mock.rb
Created July 17, 2014 14:25
Mock I18n for specs
module I18n
module Backend
class SimpleMock < Simple
def translate(locale, key, options = {})
key_with_interpolations = key.to_s + "#{options.map(&:to_s).join(",")}"
case super(:en_dev, key, options)
when String
key_with_interpolations
when Array

Star Wars opening crawl from 1977

I freaking love Star Wars, but could not find a web version of the original opening crawl from 1977. So I created this one.

I wrote an article where I explain how this works. Watch the Start Wars opening crawl on YouTube.

Stuff I used:

  • CSS (animation, transform)
  • HTML audio (the opening theme)