Forked from Hugo Giraudel's Pen Demo Flexbox 1.
A Pen by Dinesh Vasudevan on CodePen.
| 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; |
| 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 :( |
| # 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} |
Forked from Hugo Giraudel's Pen Demo Flexbox 1.
A Pen by Dinesh Vasudevan on CodePen.
| Sidekiq::Testing.inline! # Run async worker jobs synchronous |
| load Gem.bin_path('rspec-core', 'rspec') |
A Pen by Dinesh Vasudevan on CodePen.
| 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 |
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.