Skip to content

Instantly share code, notes, and snippets.

View amosrivera's full-sized avatar

Amós Rivera amosrivera

  • Managua, Nicaragua
View GitHub Profile
@amosrivera
amosrivera / kui-login.sh
Created November 14, 2013 15:30
Kui Login
cd /usr/share/sounds/ubuntu/stereo/
sudo mv desktop-login.ogg desktop-login.ogg.old
sudo wget "https://dl.dropboxusercontent.com/s/i75iiy70gomutka/desktop-login.ogg?dl=1&token_hash=AAGc5mdNY5DqejjSoiJNGxiU2gvnuTSz-M8akFxucX9KKA"
sudo mv desktop-login.ogg\?dl=1\&token_hash=AAGc5mdNY5DqejjSoiJNGxiU2gvnuTSz-M8akFxucX9KKA desktop-login.ogg
/**
* Created with IntelliJ IDEA.
* User: paulomcnally
* Date: 10/30/13
* Time: 8:53 PM
* To change this template use File | Settings | File Templates.
*/
var crypto = require('crypto');
var mssql = require('mssql');
/*
String Calculator
1- The program can take 0, 1 or 2 numbers and will
return their sum, (for an empty string it will return 0)
for example "" or "1" or "1,2" -> 0, 1, 3
2- Allow the Add method to handle an unknown amount
of numbers
@amosrivera
amosrivera / flatten.js
Created August 30, 2013 00:54
Flatten array. No matter the depth.
var flatten = function(){
var reduce = function (array) {
return array.reduce(function(r,e){
return r.concat( (e instanceof Array) ? reduce(e) : e );
},[]);
}
return reduce(Array.prototype.slice.call(arguments));
}
@amosrivera
amosrivera / format_date.php
Created October 16, 2012 09:07
Format dates in Spanish.
function format_date($date,$format) {
$es_months = array("Ene", "Abr", "Ago", "Dic");
$en_months = array("Jan", "Apr", "Aug", "Dec");
$timestamp = strtotime(str_replace($es_months,$en_months,$date));
return str_replace($en_months,$es_months,date($format,$timestamp));
}
@amosrivera
amosrivera / new_bashrc.sh
Created August 12, 2012 00:33 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
<form>
<ul>
<li data-value="true">
<input type="radio" value="true" name="choice" id="true">
<label for="true" tabindex=-1>True</label>
</li>
<li data-value="false">
<input type="radio" value="false" name="choice" id="false">
<label for="false" tabindex=-1>False</label>
</li>
@amosrivera
amosrivera / file_input_example.css
Created December 9, 2011 15:43 — forked from nathansmith/file_input_example.css
Markup to Hide a File Input
.fake_file_input {
background: url(../images/fake_file_input.png) no-repeat;
cursor: pointer;
width: 150px;
height: 30px;
overflow: hidden;
position: relative;
display: inline-block;
*display: inline;
*zoom: 1;