Skip to content

Instantly share code, notes, and snippets.

View tastycode's full-sized avatar

Sasha Devol tastycode

  • Elsewhere Labs
  • New Orleans, LA
View GitHub Profile
@tastycode
tastycode / commands0
Created June 5, 2011 02:16
Gem Flaws
root@tara:~/tmp/1008583# locate images_controller.rb
/usr/lib/ruby/gems/1.8/gems/refinerycms-images-0.9.9.21/app/controllers/admin/images_controller.rb
root@tara:~/tmp/1008583# vim `locate images_controller.rb`
@tastycode
tastycode / phpmemcached.php
Created July 6, 2011 22:31
PHP Memcached Server
<?php
/**
* A really simple memcache implementation for PHP - Based on https://gist.github.com/949850
* Run the script, it listens on port 8000
* To store a value, http://localhost:8000/write/family/key/val
* To read a value , http://localhost:8000/read/family/key
*
* This is just a proof of concept .. it doesn't handle errors etc..
*
@tastycode
tastycode / extconf.rb
Created July 22, 2011 00:46
Levenshtein C extension Draft
require 'mkmf'
dir_config('string');
create_makefile('string');
~
@tastycode
tastycode / .vimrc
Created August 16, 2011 14:12
development_tools
"pathogen is a plugin manager
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
"save my position / view next time ai load the file
au BufWinLeave * mkview
au BufWinEnter * silent loadview
"highlight column/linee
if &bg == 'dark'
@tastycode
tastycode / overlay_src
Created August 30, 2011 05:08
fb_comment_layer
/*
Facebook Comment Layer
Adds a facebook comment feed to any page
*/
(function() {
//adapted from jQuerify bookmarklet loader
//http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet
@tastycode
tastycode / gist:1252835
Created September 30, 2011 06:09
Metahash Documentation
require 'metahash'
# Writing to a file
mh = Metahash::Metahash.new "path/to/beiber.mp3"
mh["id3:artist"] = "Dave Meowtthews"
# Reading the metadata
mh = Metahash::Metahash.new "path/to/beiber.mp3"
puts mh.to_h
@tastycode
tastycode / cachemark.rake
Created November 23, 2011 16:45
Rails Cache Strategy Benchmarks
require 'benchmark'
task :benchmark => :environment do
stores = {
:file_store=>[Rails.root+"/tmp/cache"],
:mem_cache_store=>["localhost"],
:dalli_store=>["localhost"],
:redis_store=> [],
:mongo_store=> [],
}
@tastycode
tastycode / jQuery
Created December 14, 2011 05:31
Alternatives to unclear syntax wandwagon
with ({$: jQuery.noConflict()}) {
console.log("Check me out", $);
}
console.log($);
@tastycode
tastycode / gist:1475684
Created December 14, 2011 08:03
module pattern example
YAHOO.myProject.myModule = function () {
//"private" variables:
var myPrivateVar = "I can be accessed only from within YAHOO.myProject.myModule.";
//"private" method:
var myPrivateMethod = function () {
YAHOO.log("I can be accessed only from within YAHOO.myProject.myModule");
}
@tastycode
tastycode / gist:1475693
Created December 14, 2011 08:10
potential best practice for namespacing libs and defining app namespace
var Application=(function($,_) {
}(jQuery.noConflict(), _.noConflict());