Skip to content

Instantly share code, notes, and snippets.

View JuanitoFatas's full-sized avatar
🍔

Juanito Fatas JuanitoFatas

🍔
View GitHub Profile
@JuanitoFatas
JuanitoFatas / index.sh
Last active August 29, 2015 14:15 — forked from jlord/index.sh
for f in *.jpg; do
convert ./"$f" -gravity center -resize 1137 -extent 1137x640 -blur 0x4 ./finalcat/"new-$f"
convert ./finalcat/"new-$f" -page +248 ./"$f" -flatten ./finalcat/"new-$f"
done
@JuanitoFatas
JuanitoFatas / solution.md
Last active August 29, 2015 14:13
Solution to Could not download rvm, curl returned status '23'
Downloading https://github.com/wayneeseguin/rvm/archive/1.26.9.tar.gz
curl: (23) Failed writing body (0 != 861)
Could not download 'https://github.com/wayneeseguin/rvm/archive/1.26.9.tar.gz'.
curl returned status '23'.
Downloading https://bitbucket.org/mpapis/rvm/get/1.26.9.tar.gz
curl: (23) Failed writing body (0 != 15973)
Could not download 'https://bitbucket.org/mpapis/rvm/get/1.26.9.tar.gz'.
# app/models/ability.rb
module Ability
class << self
def ability_for user, options = {}
abilities = AnonymousAbility.new
return abilities unless user
abilities.merge MemberAbility.new user, options
Idea.find_each do |idea|
  idea.picture.recreate_versions!(:thumb)
end
@JuanitoFatas
JuanitoFatas / to-proc-hack.md
Last active August 29, 2015 14:09
to_proc hack vs built-in
require 'benchmark/ips'

class Array
  def to_proc
    ->(h) { length == 1 ? h[first] : h.values_at(*self) }
  end
end

LANGUAGE_AND_AGE = [

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@JuanitoFatas
JuanitoFatas / forwardable.rb
Created June 30, 2014 07:03
Forwardable and SingleForwardable (without comments) from https://github.com/ruby/ruby/blob/trunk/lib/forwardable.rb
module Forwardable
FORWARDABLE_VERSION = "1.1.0"
FILE_REGEXP = %r"#{Regexp.quote(__FILE__)}"
@debug = nil
class << self
attr_accessor :debug
end
@JuanitoFatas
JuanitoFatas / levenshtein_distance.rb
Last active August 29, 2015 14:03
Levenshtein Distance in Ruby using matrix
# Levenshtein Distance
# implementation given at http://en.wikipedia.org/wiki/Levenshtein_distance
# This file is in the public domain.
require 'matrix'
def levenshtein_distance str1, str2
str1_len = str1.size
str2_len = str2.size
width = str1_len + 1
@JuanitoFatas
JuanitoFatas / 500.log
Created June 23, 2014 21:05
YouTube 500
500 Internal Server Error
Sorry, something went wrong.
A team of highly trained monkeys has been dispatched to deal with this situation.
If you see them, show them this information:
AB38WEP4JRdI_m4SFO2vFKPSuj3aFEwG3uopBpGPl8m2FrTp4DpsVRa2fT7s
4sgBLq8tCq0RY29fbUrN8dYjRC_A1yq8XyAk0xF8CWGf9IJsB0UuitmDmnyh
YB0lj3lHaPgfSmFz5BNbtjltGRjHwgexw0WvuKq-rvx0lJtt4PsbH6ZGzywG