Skip to content

Instantly share code, notes, and snippets.

View dux's full-sized avatar

Dino Reić dux

  • Trifolium
  • London, Zagreb, Berlin
View GitHub Profile
@dux
dux / gist:1177058
Created August 28, 2011 19:01
try to find login form, user and pass input nodes - used on http://cryptero.com
var c_user, c_pass, c_form;
(function() {
for (var i=0;document.forms[i]; i++) {
for (j=0;document.forms[i][j];j++) {
if(document.forms[i][j].type=='text') {
c_user = document.forms[i][j]
}
if(document.forms[i][j].type=='password') {
c_form = document.forms[i]
@dux
dux / gist:1176673
Created August 28, 2011 13:31
Time diff in rails for secconds since created
(Time.parse(DateTime.now.to_s) - Time.parse(current_user.created_at.to_s)).to_i
@dux
dux / Coffee script Url parser and builder
Created August 15, 2011 20:43
Simple coffee script Url class
class Url
constructor: (@path_and_qs=location.href) ->
[@path, @qs_data] = @path_and_qs.split '?',2
@qs = {}
for elms in @qs_data.split '&'
el = elms.split '=', 2
@qs[el[0]] = el[1]
build: ->
ret = new Array