Skip to content

Instantly share code, notes, and snippets.

View abimaelmartell's full-sized avatar

Abimael Martell abimaelmartell

View GitHub Profile
Person = {
instance: function(name, lastname)
{
var base = this;
base._private = {}
base._public = {}
base._private.name = name;
base._private.lastname = lastname;
@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@olistik
olistik / gist:2627011
Last active August 12, 2021 06:39
Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)

Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)

Basic pre-requisites

  • Some utilities:
sudo apt-get install vim tmux git curl
  • Copy/paste from the command line:
@tonycoco
tonycoco / image_filters.rb
Created June 11, 2012 15:04
Useful image filters (Instagram/Hipster/Cool) for CarrierWave using MiniMagick (ImageMagick)
module CarrierWave
module MiniMagick
def toaster_filter
manipulate! do |img|
img.modulate '150,80,100'
img.gamma 1.1
img.contrast
img.contrast
img.contrast
img.contrast
@mhcornejo
mhcornejo / test.js
Created July 10, 2012 20:14
Imprimir los numeros del 1 al 1000 sin bucles o condiciones
var functions = {
a1: function (number, max) { return print(number + 1, max); },
aNaN: function (number, max) { return null;}
};
function print(number, max){
document.write(number + '<br />');
var left = max - number;
var index = left/left;
return functions['a' + index.toString()](number, max);
}
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@cpq
cpq / embed.c
Last active March 4, 2024 10:45
How to embed data files into C/C++ executable
// Copyright (c) Sergey Lyubka, 2013.
// All rights reserved.
// Released under the MIT license.
// This program is used to embed arbitrary data into a C binary. It takes
// a list of files as an input, and produces a .c data file that contains
// contents of all these files as collection of char arrays.
// Usage:
// 1. Compile this file:
// cc -o embed embed.c
@javierg
javierg / gist:4742784
Created February 8, 2013 23:21
Fortune Teller Machine
class FortuneTellerMachine
WELCOME = "Hola ¿Quiéres saber tu fortuna?"
REQUEST = "Fortuna por monedas, yo quiero yo quiero monedas (2): "
CHANGE_BACK = "Here is your change"
COST = 2
def initialize
clear
end
@ZephiroRB
ZephiroRB / extract.rb
Last active December 12, 2015 10:29 — forked from abimaelmartell/texto.rb
Ejemplo de Iteración de archivo, gracias a abimael martel
a = File.read './legal.txt'
b = a.force_encoding("ISO-8859-1").encode("utf-8", replace: nil).scan(/inicio([\s\S]+?)fin/)
c = []
b.each do |r|
d = {}
d[:fecha] = r.to_s.scan(/Lima, el (.+?),/).join
@puffnfresh
puffnfresh / where_tdd_fails.md
Last active December 14, 2015 13:39
Where TDD Fails (mirror for http://blog.precog.com/?p=431)

Where TDD Fails

I've just gotten back from the awesome mloc.js conference. There was a talk about compiling C# to JavaScript and one of the benefits explained was static types. Someone from the audience asked, who needs types when you do Test Driven Development?

I tried to address the question in my talk on Roy but I talked to some developers afterwards and they thought that TDD