Skip to content

Instantly share code, notes, and snippets.

View emberian's full-sized avatar

emberian

View GitHub Profile
@emberian
emberian / BXscGvpi
Created March 25, 2012 20:25 — forked from anonymous/BXscGvpi
a guest on Mar 25th, 2012 - -.- ?
function lastElement(array) {
if (array.length > 0)
return array[array.length - 1];
else
return null;
}
show(lastElement([1, 2, null]));
@emberian
emberian / foo.coffee
Created March 13, 2012 02:03 — forked from anonymous/gist:2026105
a guest on Mar 12th, 2012 - pastebin.com/QAzuZUDr
response_handler = (response)=>
buf = null
ptr = 0
response.on "data", (chunk) =>
if not buf
if response.headers['content-length']
buf = new Buffer(parseInt(response.headers['content-length'],10)+2)
else
buf = ''
@emberian
emberian / gist:2019014
Created March 12, 2012 01:00 — forked from anonymous/gist:2018992
a guest on Mar 11th, 2012 - pastebin.com/0DWetuis
function secondsFromTime(string){
var split = string.split(":")
var seconds = parseInt(split.pop())
if (seconds !== NaN) {
var minutes = parseInt(split.pop())
if (minutes !== NaN) {
var hours = parseInt(split.pop())
if (hours !== NaN) {
return hours * 60 * 60 + minutes * 60 + seconds
@emberian
emberian / gist:1813914
Created February 13, 2012 05:23 — forked from anonymous/gist:1813906
TheAbacus - pastebin.com/qY1e6sjm
// JavaScript Document
function Temp() {
var test = "testing";
}
Temp.prototype.init = function() {
test = this.test;
$.ajax({ //IE errors here.
url: "xd_subnav.xml",
dataType: "xml",