Skip to content

Instantly share code, notes, and snippets.

@jimmiw
jimmiw / Bibob data forbrug beregning
Created January 14, 2011 10:17
På bibob's site, under forbrug, så kan man se en oversigt og pris for ens data forbrug, MEN ikke hvor meget man har brugt i den periode. Her er et lille script der kan fyres af, for at få det i listen også
/**
* Gå ind på mit bibob, vælg "Mit forbrug", skriv din periode, åben firebug,
* og brug konsollen og kopier følgende kode stump ind. Så kan du se hvor
* meget data du har brugt for den valgte periode.
*/
var total = 0;
$('#table_0 table .usageCell5subsub nobr').each(function() {
total += Number($(this).text().split(' ')[0]);
})
@jimmiw
jimmiw / created_at-and-updated_at.sql
Created June 16, 2010 20:45
created_at datetime default now()
# If you need to add a created_at field in your database
# that inserts "now()" when the insert statement is run, you
# can use the following script.
# It uses timestamps, but removes the "on update" for the
# created_at column, but keeps it on the updated_at (which
# needs to update at every change).
#
# got this snippet here:
# http://bugs.mysql.com/bug.php?id=27645
# (search for: "[7 Oct 2009 4:25] Diego Medina")
/**
* this.printout(data); cannot be called. The .each on the array removes the current scope
*/
var EachTest = Class.create({
test: function() {
var arr = Array();
arr.push("a");
arr.push("b");
arr.push("c");
arr.push("d");
* install firefox != 3.0
http://mozilla.com
bunzip2 firefox.tar.bz2
tar xfv firefox.tar
sudo mv firefox /usr/local/
* rerun every at Ubuntu firefox update
cd /usr/bin
sudo mv firefox firefox_bak
sudo ln -s /usr/local/firefox/firefox .
$('#contact_form').bind('submit', function(e) {
return false;
});
$('#submit_button').bind('click',function(e) {
e.stopPropagation();
var contact = $('#form_name').val();
var comment = $('#form_comment').val();
if(contact != '') {
Event.observe('submit_button','click', function(e) {
e.stop();
var contact = $('form_name').getValue();
var comment = $('form_comment').getValue();
if(contact != '') {
var phoneRegExp = new RegExp('^[+]{0,1}[0-9]+$');
var emailRegExp = new RegExp('^[a-zA-Z0-9._+-]+[@]{1}[a-zA-Z0-9._-]+[.]{1}[a-zA-Z0-9]+$');
if(phoneRegExp.test(contact) || emailRegExp.test(contact)) {
sudo apt-get install libssl-dev
sudo apt-get install libreadline5 libreadline5-dev libreadline-ruby1.8 readline-common
wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6-p383.tar.gz
tar xzfv ruby-1.8.6-p383.tar.gz
cd ruby-1.8.6-p383
./configure
make
sudo make install