Skip to content

Instantly share code, notes, and snippets.

@marano
marano / gist:108160
Created May 7, 2009 15:29
A core string extension that Ive used many times.
class String
def canonical
mb_chars.strip.normalize(:kd).gsub(/[^\x00-\x7F]/n,'').downcase.to_s
end
def trim
gsub(/ /,'')
end
@marano
marano / Custom Feedzirra Flickr parser
Created June 12, 2010 17:19
Custom Feedzirra parsers
module Feedzirra
module Parser
class FlickrEntry
include SAXMachine
include FeedEntryUtilities
element :guid, :as => :id
element :link, :as => :url
@marano
marano / gist:2720500
Created May 17, 2012 17:47
Happy console
export PS1='$( [[ ${?#0} = "" ]] && echo ":) " || echo ":( " )'
set nocompatible
filetype off
set hlsearch
set tabstop=2
set shiftwidth=2
set expandtab
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
@marano
marano / link_opener.rb
Created October 16, 2012 19:55
Quick and dirty way to get link content in ruby that handles redirects and https.
@marano
marano / robot.js
Created December 6, 2012 04:09
Shrimp Hunter 2000
var aVera = true;
var Robot = function(robot) {};
var RobotState = function (rotateStep) {
data = {};
data.id = 0;
data.isLookingAtTarget = false;
data.timesShooting = 0;
data.rotateStep = rotateStep;
@marano
marano / robot.js
Created December 6, 2012 17:50
Shrimp Hunter
var aVera = true;
var Robot = function(robot) {};
var RobotState = function (rotateStep) {
data = {};
data.id = 0;
data.isLookingAtTarget = false;
data.timesShooting = 0;
data.rotateStep = rotateStep;
@marano
marano / generate_secret.rb
Created November 7, 2015 14:06
Generate random secret
all_characters = [('a'..'z'), ('A'..'Z'), (0..9)].map { |i| i.to_a }.flatten
secret = (0...100).map { all_characters[rand(all_characters.length)] }.join
puts secret
gem 'eb_deployer'
@marano
marano / 0_reuse_code.js
Created April 5, 2016 16:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console