Skip to content

Instantly share code, notes, and snippets.

View yeco's full-sized avatar

Jasson Cascante yeco

View GitHub Profile
typeof null //Object, duh!
function twitterify($ret) {
$ret = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
$ret = preg_replace("/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $ret);
$ret = preg_replace("/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $ret);
"3" + 1 // '31'
"3" - 1 // 2
"222" - -"111" // "333" (⊙﹏⊙)
@yeco
yeco / laughable.js
Created February 19, 2010 06:26 — forked from dandean/laughable.js
function laugh()
{
return
{
haha: "ha!"
};
}
laugh();
// returns undefined
function sum( A ) {
var result = 0;
for(var i = 0;i < A.length;i++) {
result += A[i]
}
return result
}
function equi ( A ) {
var r = sum(A);
def equi(A):
l, r = 0, sum(A)
for i, e in enumerate(A):
r -= e
if l == r:
return i
l += e
return -1
function equi ( $A ) {
$total = array_sum($A);
foreach($A as $key => $value){
if(($accumulated) == ($total - $accumulated - $value)){
return $key;
}
$accumulated += $value;
}
return -1;
}
# Sounder sounds for class
# Requires an active microphone to pick up anything
require 'ruby-processing'
class MinimTest < Processing::App
load_library "minim"
import "ddf.minim"
import "ddf.minim.analysis"
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'uri'
require 'net/http'
require 'digest/md5'
require 'rexml/document'
require 'extlib'
require 'yaml'
function eliminarDuplicados(a) {
var i,
l = a.length,
o = [],
ob = {};
for (i = 0; i < l; i++) {
ob[a[i]] = 0;
}