Skip to content

Instantly share code, notes, and snippets.

View americos's full-sized avatar
💭
Coding, coding, and coding some more

Americo Savinon americos

💭
Coding, coding, and coding some more
  • Malaga, Spain
  • 14:56 (UTC +02:00)
  • X @americos
View GitHub Profile
@americos
americos / LocationCalendarDayHours.rb
Last active August 29, 2015 13:57
Stack level too deep?
# Why I get stack level too deep in IRB, when calling:
# location = VendorLocation.find 53575
# LocationCalendarDayHours.from_java_json(location.calendarHours).first.weekday_type_code
#
# Note: I created weekday_type.rb as a WwConstant
class LocationCalendarDayHours
include ActiveModel::Model
include WWLegacyJavaJsonSupport
@americos
americos / retina@2x_2x
Created April 28, 2014 18:50
Renaming retina images filenames from: @2x to _2x
for filename in *@2x*; do mv "$filename" "${filename//@2x/_2x}"; done
##Based on: https://gist.github.com/871284e41058014863e0
MAGENTA="\033[1;31m"
ORANGE="\033[1;33m"
GREEN="\033[1;32m"
PURPLE="\033[1;35m"
WHITE="\033[1;37m"
BOLD=""
RESET="\033[m"
parse_git_dirty () {
[alias]
co = checkout
a = add
s = show
st = status
d = diff
ds = diff --staged
ci = commit
br = branch
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
@americos
americos / SassMeister-input.scss
Created February 17, 2015 22:25
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
// Width
@each $index, $width in (1: 15%, 2: 30%, 4: 45%) {
.collage-width-#{$index} {
width: $width;
@americos
americos / SassMeister-input.scss
Last active August 29, 2015 14:15
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
//Width
@each $index, $width in (1: 15%, 2: 30%, 4: 45%) {
.collage-width-#{$index} {
width: $width;
overflow: hidden;
@americos
americos / game.rb
Created December 16, 2010 05:46
Main class for Codebreaker
module Codebreaker
class Game
def initialize(output)
@output = output
end
def start(secret)
@secret = secret
@output.puts 'Welcome to Codebreaker!'
@output.puts 'Enter guess:'
@americos
americos / selenium_webrat_cucumber.rb
Created January 11, 2011 15:48
Lines needed on features/suppor/env.rb to enable selenium automated browser testing
#Remember to get the proper gems on your gem file:
# gem 'database_cleaner', '>= 0.5.2'
# gem 'selenium-client', '>= 1.2.18'
# then: bundle install
#Step 1 for using Selenium. This goes after ActionContoller allow_resque line /Americo
Cucumber::Rails::World.use_transactional_fixtures = false
#Step 2 for using Selenium This goes at the bottom of the file /Americo
class ActiveSupport::TestCase
@americos
americos / setting_git.txt
Created January 12, 2011 16:30
Lines commonly used while setting up your project on github
Set Repo
$ git init
Add all files/folders
$ git add .
Push up code
$ git remote add origin git@githyb.com:<username>/app_name.git
$ git push origin master