Skip to content

Instantly share code, notes, and snippets.

View victusfate's full-sized avatar
🚀

Mark Essel victusfate

🚀
View GitHub Profile
class BaseTask
def self.perform(*args)
ActiveRecord::Base.verify_active_connections!
end
end
class SomeTask < BaseTask
def self.perform(*args)
super
# do some stuff
# 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
@victusfate
victusfate / coucheval.js
Created January 13, 2012 20:33 — forked from anandology/coucheval.js
node.js script to process couchdb output
#!/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();
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() {
@victusfate
victusfate / gist:1409428
Created November 30, 2011 15:18 — forked from benshimmin/gist:1397473
CoffeeScript to load SVG, extract all paths, and render them using Raphaël JS
$ ->
# load some SVG, call render() on successful load
$.ajax(
url : "data/file.svg"
dataType : "xml"
success : render
)
render = (data) ->
srcPaths = SVGExtractPaths.extract data
@victusfate
victusfate / gtest.html
Created November 8, 2011 11:24 — forked from NeoCat/gtest.html
Google+ API JavaScript Sample
<!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>
@victusfate
victusfate / node-and-npm-in-30-seconds.sh
Created October 23, 2011 22:26 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
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
@victusfate
victusfate / config.ru
Created October 16, 2011 18:41 — forked from mislav/config.ru
Shortest simplest sweetest web "hello {NAME}" in Ruby
run ->(e){ p=Hash[*e['QUERY_STRING'].split(/[&=]/)]; [200, {'Content-type'=>'text/html'}, ["Hello #{p['name']}!"]] }
@victusfate
victusfate / google-charts.coffee
Created September 23, 2011 10:36 — forked from bycoffe/google-charts.coffee
Basic Google Charts API wrapper in CoffeeScript
class window.GoogleChart
constructor: ->
@width = 0
@height = 0
@encoded = []
@data = []
simpleEncoding: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
extendedMap: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.',
@victusfate
victusfate / flexbox.html
Created September 20, 2011 19:27 — forked from sporkmonger/flexbox.html
Flexbox Layout
<!DOCTYPE html>
<html>
<head>
<title>Flexbox Layout</title>
<style>
article {
border: 1px solid red;
display: -webkit-box;
display: -moz-box;
display: box;