This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function resizeimage(img) { | |
var max_width = img.parent().width(); | |
var max_height = img.parent().height(); | |
//console.log('max dimensions are: %s x %s', max_width, max_height); | |
var width = img.width(); | |
var height = img.height(); | |
//console.log('img dimensions are: %s x %s', width, height); | |
var image = img; | |
(image.width()/image.parent().width()) > (image.height()/image.parent().height()) ? | |
image.css({'width':'100%'}) : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql # run this in terminal | |
mysql> set global time_zone='UTC'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# type dscacheutil -flushcache in your terminal to flush the DNS resolver cache. | |
# ex: bash-2.05a$ dscacheutil -flushcache | |
# Once you run the command your DNS cache (in Mac OS X Leopard) will flush. | |
dscacheutil -flushcache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I started seeing this error when I used CPAN to fetch stuff: | |
Fetching with LWP: | |
ftp://ftp.planetmirror.com/pub/perl/CPAN/modules/02packages.details.txt.gz | |
LWP failed with code[400] message[FTP return code 000] | |
Fetching with Net::FTP: | |
ftp://ftp.planetmirror.com/pub/perl/CPAN/modules/02packages.details.txt.gz | |
Couldn't fetch 02packages.details.txt.gz from ftp.planetmirror.com | |
Fetching with LWP: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -urb /dir/one /dir/two |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/local/bin/perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
my @windows = qw/one two three four/; | |
my %windows = map { $_ => $_ } @windows; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Choose random window, the Ruby way ;-) | |
windows_array = ['one', 'two', 'three', 'four'] | |
windows_hash = Hash[ *windows_array.collect { |v| [ v, v ] }.flatten ] | |
def get_random_window(wa,wh) | |
windows_count = wa.length | |
puts "We have #{windows_count} windows" | |
chosen = rand(windows_count); | |
name = wa[chosen] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use lib 'lib'; | |
use Test::WWW::Selenium; | |
use WWW::Selenium::Util qw(server_is_running); | |
use Test::More; | |
my ($host, $port) = server_is_running(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; hilight some useful keywords | |
(set-face-background 'font-lock-warning-face "yellow") | |
(set-face-foreground 'font-lock-warning-face "black") | |
(add-hook 'font-lock-mode-hook | |
(lambda () | |
(font-lock-add-keywords nil | |
'(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face prepend))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# script to ping server for activity | |
# Author: Adeola Awoyemi ([email protected]) | |
require 'net/http' | |
require 'uri' | |
urls = [ | |
'http://www.photobox.co.uk/', | |
'http://www.idontexist.co.uk/' | |
] |
OlderNewer