Skip to content

Instantly share code, notes, and snippets.

lu1s /
Last active Dec 7, 2017
Run this script to get updated BTC price in MXN pesos. If it raises it prints green, if lowers, red, and if stays the same it won't print until it gets a new one. It requires python to parse the json response. It checks every 3 seconds.
function get_json_val () {
python -c "import json,sys;sys.stdout.write(json.dumps(json.load(sys.stdin)$1))";
function print_red () {
printf "\033[0;31m$1\033[0m"
echo ""
function print_green () {
lu1s / RandomStringHelper.cs
Created Jul 11, 2013
Random string c# static method and its enum
View RandomStringHelper.cs
// Use it like:
// RandomStringHelper.RandomString(32, EnumRandomStringType.AlphaNumericWithSymbols);
// and it should return a string like "nd#9ian@iddjhn*And08183Anqov3a8Z"
public class RandomStringHelper
private enum EnumRandomStringType
AlphaNumeric = 1,
Numbers = 2,
Letters = 3,
lu1s / objeq.js
Created Apr 11, 2012
javascript object equality
View objeq.js
// y and x can be whatever you look for equality
function objeq(y,x)
var p;
for(p in y) {
if(typeof(x[p])=='undefined') {return false;}
for(p in y) {
if (y[p]) {
lu1s / charCount_prevent.js
Created Mar 24, 2012
jQuery Character Count Plugin with preventExceeding extension
View charCount_prevent.js
* Character Count Plugin - jQuery plugin
* Dynamic character count for text areas and input fields
* written by Alen Grakalic
* Copyright (c) 2009 Alen Grakalic (
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
lu1s / get-random-flickr-user-pic-jquery.js
Created Mar 17, 2012
Get random flickr picture from given user id and append to given div id (needs jquery and flickr api key)
View get-random-flickr-user-pic-jquery.js
function getPicture(the_user_id, your_div_id){
var apiKey = "YOUR-API-KEY"; // replace this with your API key
var url_to_a_photo_head = ""+apiKey+"&photo_id=";
var url_to_a_photo_tail = "&format=json&jsoncallback=?";
// get an array of random photos
lu1s / gmaps-quick-addr-map.js
Created Sep 7, 2011
google maps quick address map
View gmaps-quick-addr-map.js
* Google Maps Quick Address Map
* This snippet gets an address (parameter a)
* and plots a Google Map with a centered
* marker in the id-given element (parameter e)
* You need to add the Google Maps V3 API to your site:
* <script type="text/javascript" src=""></script>
* Enjoy!
View jquery-message-bar.js
* jQuery Message Bar
* @author Luis Pulido <>
* @params:
* what: String, the message to be displayed
* time (optional): Number, the time in milliseconds the bar will
* stay displaying. Default is 2000 ms
* opts (optional): Object, some optional values to customize the bar:
* - height: default 20px
* - fontSize: default 14px
lu1s / jquery-alert-hack.js
Created Jun 27, 2011
jQuery alert() beautify and more user friendly
View jquery-alert-hack.js
* This function replaces the javascript native alert() function.
* I know that by convention it's not a good practice, but if you want to
* follow strict stuff, just declare the function with another name and
* call it as that.
* jQuery.js is required (
* The function can be called like this:
* For static (not auto-hide) alert bar:
lu1s / cookie-handler.js
Created May 16, 2011
javascript cookie handler
View cookie-handler.js
You can’t perform that action at this time.