This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
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 () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Character Count Plugin - jQuery plugin | |
* Dynamic character count for text areas and input fields | |
* written by Alen Grakalic | |
* http://cssglobe.com/post/7161/jquery-plugin-simplest-twitterlike-dynamic-character-count-for-textareas | |
* | |
* Copyright (c) 2009 Alen Grakalic (http://cssglobe.com) | |
* Dual licensed under the MIT (MIT-LICENSE.txt) | |
* and GPL (GPL-LICENSE.txt) licenses. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = "http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key="+apiKey+"&photo_id="; | |
var url_to_a_photo_tail = "&format=json&jsoncallback=?"; | |
// get an array of random photos | |
$.getJSON( | |
"http://api.flickr.com/services/rest/", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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="http://maps.googleapis.com/maps/api/js?sensor=false"></script> | |
* | |
* Enjoy! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* jQuery Message Bar | |
* @author Luis Pulido <[email protected]> | |
* @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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 (http://jquery.com) | |
* | |
* The function can be called like this: | |
* For static (not auto-hide) alert bar: |