Skip to content

Instantly share code, notes, and snippets.

View m-mujica's full-sized avatar

Manuel Mujica m-mujica

View GitHub Profile
var UUID = function() {
// The object literal used to keep track of all of the generated IDs.
this.used = {};
};
// The globally visible function which is used to generate
// UUID that are unique for the remainder of the page session.
UUID.prototype.generate = function(id) {
for(;this.used[id = this.randomHex(8) + "-" + this.randomHex(4) + "-"
+ this.randomHex(4) + "-" + this.randomHex(4) + this.randomHex(8)];){}
@m-mujica
m-mujica / noledebesnada.md
Last active December 15, 2015 04:29
Algunos pensamientos sobre los argumentos que he escuchado para apoyar el actual gobierno venezolano. (Estoy seguro que Github no había previsto ésto :P)

Hace días he estado planeado escribir sobre lo que pienso ante algunos argumentos que he recibido de familiares y conocidos acerca de porque quieren continuar el apoyo al actual gobierno/gestión. Entre estas razones, algunas quedaron rebotando en mi mente, como: Me gradué gracias a ESTA gestión, tengo una beca gracias a ESTA gestión, tengo casa gracias a ESTA gestión y así en lo sucesivo.

Quiero entonces destacar, que no existe tal cosa como una deuda para con un gobierno. Me explico, las personas acuden a las elecciones para elegir a quienes creen hará mejor uso de los recursos del Estado con el objetivo de mejorar la calidad de vida de los ciudadanos (apoyen éstos o no al vencedor), abarcando ésto un conjunto diverso de aspectos como la educación, la salud, la seguridad, y el bienestar económico. Que se construyan casas, que se creen universidades, canchas, que se concedan incentivos económicos, no son acciones por las que un pueblo debe

@m-mujica
m-mujica / postgresql_setup.md
Last active December 31, 2019 14:43
Set up PostgreSQL for Rails Local Development in Linux
@m-mujica
m-mujica / pull_heroku.md
Created June 3, 2013 02:57
Pull heroku database down to local
$ curl -o latest.dump `heroku pgbackups:url -a APPLICATION_NAME`
$ rake db:reset
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U root -d YOUR_LOCAL_DB_NAME latest.dump
$ rm latest.dump
var sum = function sum(x, y) {
if (!x) {
x = 200;
}
if (!y) {
y = 300;
}
return x + y;
A zero-indexed array A consisting of N integers is given.
An equilibrium index of this array is any integer P such that 0 ≤ P < N
and the sum of elements of lower indices is equal to the sum of elements of higher indices,
i.e. A[0] + A[1] + ... + A[P−1] = A[P+1] + ... + A[N−2] + A[N−1].
Sum of zero elements is assumed to be equal to 0. This can happen if P = 0 or if P = N−1.
For example, consider the following array A consisting of N = 7 elements:
A[0] = -7 A[1] = 1 A[2] = 5
require 'date'
def is_valid_date? year, month, day
return false if year < 2000 || year > 2999
Date::valid_date?(year, month, day)
end
class Date
def is_valid_date_for_millenium? millenium
// write a function that takes an argument
// and returns that argument.
function identity(x) {
return x;
}
// write two binary functions, add and mul,
// that take two numbers and return their sum and product.
-- Exercise 1
-- We need to first find the digits of a number.
-- Define the functions
-- toDigits :: Integer -> [Integer]
-- toDigitsRev :: Integer -> [Integer]
-- toDigits should convert positive Integers to a list of digits. (For 0 or
-- negative inputs, toDigits should return the empty list.) toDigitsRev
-- should do the same, but with the digits reversed.
@m-mujica
m-mujica / who-imported.html
Created October 12, 2015 13:58 — forked from matthewp/who-imported.html
Who imported me?
<script src="node_modules/steal/steal.js"></script>
<script>
var oldNormalize = System.normalize;
System.normalize = function(name, parentName){
return oldNormalize.apply(this, arguments).then(function(name){
if(name === "my/module") {
console.log(name, "is imported by", parentName);
}
return name;
});