Skip to content

Instantly share code, notes, and snippets.

View yeco's full-sized avatar

Jasson Cascante yeco

View GitHub Profile
@yeco
yeco / dl.pl
Created March 7, 2011 18:17
Reads from a todo list and downloads each of the files in turn.
#!/usr/bin/perl
# dl.pl
# Reads from a todo list and downloads each of the files in turn.
# Maintains a list of URLS already downloaded to avoid extra effort
use Digest::MD5 qw(md5_hex);
# Initialize (Put this in a config file?)
$home_dir = $ENV{HOME};
$user = $ENV{USER};
javascript:void((function(){function%20load(type,%20src)%20{if%20(type%20==%20'css')%20{%20var%20s%20=%20document.createElement('link');s.setAttribute('href',%20src);s.setAttribute('type',%20'text/css');s.setAttribute('rel',%20'stylesheet');}%20else%20{var%20s%20=%20document.createElement('script');s.setAttribute('src',%20src);s.setAttribute('type',%20'text/javascript');}%20document.getElementsByTagName('head')[0].appendChild(s);%20};%20function%20whenLoaded(callback){%20if%20(typeof(window['jQuery'])%20!=%20'undefined'%20&&%20typeof(window['jQuery']['fn']['sundayMorning'])%20==%20'function')%20{%20callback();%20}%20else%20{setTimeout(function()%20{whenLoaded(callback)%20},%20100);}%20};load('src',%20'http://code.jquery.com/jquery-latest.pack.js');load('src',%20'http://sundaymorning.jaysalvat.com/bookmarklet/jquery.sundaymorning.js');load('css',%20'http://sundaymorning.jaysalvat.com/bookmarklet/jquery.sundaymorning.css');whenLoaded(function()%20{alert('Knowledge%20Elements\n\nReady%20to%20translate!\nDouble-c
@yeco
yeco / GoDaddy CLI
Created June 21, 2011 07:03 — forked from ernie/GoDaddy CLI
If GoDaddy did CLI domain registration...
$ godaddy buy wynn.fm
-- Reading CC Info from .godaddy...
-- THANK YOU FOR PURCHASING YOUR DOMAIN WITH GODADDY!
-- WHILE OUR SERVERS THINK ABOUT REGISTERING YOUR DOMAIN
-- NAME, PLEASE GIVE CAREFUL CONSIDERATION TO THE
-- FOLLOWING SPECIAL OFFERS!!!
Would you like to also register the following and SAVE 64%?
wynn.net
@yeco
yeco / gist:1110218
Created July 27, 2011 19:51 — forked from getify/gist:1110207
ugly hack to figure out the actual viewport dimensions (sans scrollbars)
// do the hack
document.childNodes[1].style.width = "100%"; // set the HTML to 100%/100%
document.childNodes[1].style.height = "100%";
document.body.style.width = "100%"; // set the <body> to 100%/100%
document.body.style.height = "100%";
var viewportDimsHack = this.treeBrowserDocument.createElement("div");
viewportDimsHack.style.position = "fixed";
viewportDimsHack.style.left = "0px";
viewportDimsHack.style.top = "0px";
@yeco
yeco / HelloDartTest.dart
Created October 11, 2011 04:38
Dart Compilation
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Simple test program invoked with an option to eagerly
// compile all code that is loaded in the isolate.
// VMOptions=--compile_all
class HelloDartTest {
static testMain() {
print("Hello, Darter!");
@yeco
yeco / getElementsInRegion.js
Created October 26, 2011 05:34
getElementsInRegion.js
function getElementsInRegion(x, y, width, height) {
var elements = [],
expando = +new Date,
cx = x,
cy = y,
curEl;
height = y + height;
width = x + width;
@yeco
yeco / 1-jumpingAppDelegate.m
Created October 26, 2011 06:03
Evento Touch y animación para juegos básica con Objective-C
// Asigna un nuevo view:
self.viewController = [jumpingViewController alloc];
[window addSubview:viewController.view];
@yeco
yeco / urlencode.js
Created October 27, 2011 18:46
urlencode en javascript
function urlencode( str ) {
// * ejemplo 1: urlencode('Yeco is Lazy!');
// * retorna 1: 'Yeco+is+Lazy%21'
// * ejemplo 2: urlencode('http://Yeco.isLazy.net/');
// * retorna 2: 'http%3A%2F%2FYeco.isLazy.net%2F'
// * ejemplo 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a');
// * retorna 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a'
var histogram = {}, unicodeStr='', hexEscStr='';
@yeco
yeco / soapclient.js
Created November 10, 2011 19:44
SoapClient
function SOAPClientParameters()
{
var _pl = new Array();
this.add = function(name, value)
{
_pl[name] = value;
return this;
}
this.toXml = function()
{
/**
* parseTemplate takes a string and a JS Object and returns a string with template
* replaced with content you provided. Template tags look like: {{tag}}
* @param {String} s This is the string to search for tags in.
* @param {Object} j This is the JS object that contains a key=>value pair for the tag and what to be replaced
* @returns {String} returns the modified string with the content you provided in replacement of the tags
* @example var html = parseTemplate('Hey, {{name}}',{ name:'John' }); //returns "Hey, John"
*/
var parseTemplate = function(s,j){
for(x in j){ var r = new RegExp('{{'+x+'}}','g'); s = s.replace(r,j[x]); }