This file contains hidden or 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 BaseTask | |
| def self.perform(*args) | |
| ActiveRecord::Base.verify_active_connections! | |
| end | |
| end | |
| class SomeTask < BaseTask | |
| def self.perform(*args) | |
| super | |
| # do some stuff |
This file contains hidden or 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
| # To configure memcached to be used | |
| # /config/environment.rb | |
| config.cache_store = :mem_cache_store | |
| # Object Store cache commands | |
| Rails.cache.read | |
| Rails.cache.write | |
| Rails.cache.fetch |
This file contains hidden or 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
| #!/usr/bin/env node | |
| // Sample usage: | |
| // | |
| // $ curl -s 'http://127.0.0.1:15984/seeds/_all_docs?limit=10&include_docs=true' | coucheval.js 'console.log(JSON.stringify(row.doc));' | |
| // | |
| var carrier = require('carrier'); | |
| var stdin = process.openStdin(); |
This file contains hidden or 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
| if (typeof jQuery == 'undefined') { | |
| var jQ = document.createElement('script'); | |
| jQ.type = 'text/javascript'; | |
| jQ.onload=loadDeps; | |
| jQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'; | |
| document.body.appendChild(jQ); | |
| } else { | |
| loadDeps(); | |
| } | |
| function loadDeps() { |
This file contains hidden or 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
| $ -> | |
| # load some SVG, call render() on successful load | |
| $.ajax( | |
| url : "data/file.svg" | |
| dataType : "xml" | |
| success : render | |
| ) | |
| render = (data) -> | |
| srcPaths = SVGExtractPaths.extract data |
This file contains hidden or 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
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <title>Google+ API Test</title> | |
| </head> | |
| <body> | |
| <button onclick="authBegin()">Login</button><br> | |
| <button onclick="getPublicActivities($('user').value)">Get activities of user </button><input id="user" size="10" value="me"><br> |
This file contains hidden or 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
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl http://npmjs.org/install.sh | sh |
This file contains hidden or 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
| run ->(e){ p=Hash[*e['QUERY_STRING'].split(/[&=]/)]; [200, {'Content-type'=>'text/html'}, ["Hello #{p['name']}!"]] } |
This file contains hidden or 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 window.GoogleChart | |
| constructor: -> | |
| @width = 0 | |
| @height = 0 | |
| @encoded = [] | |
| @data = [] | |
| simpleEncoding: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' | |
| extendedMap: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.', |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Flexbox Layout</title> | |
| <style> | |
| article { | |
| border: 1px solid red; | |
| display: -webkit-box; | |
| display: -moz-box; | |
| display: box; |