Skip to content

Instantly share code, notes, and snippets.

refn = function() {
source("fn.r");
}
plot_ut_text = function() {
p = plot_ut_abstract() + geom_text(aes(label = p1remaining, colour = p1remaining), size = 3)
p
}
plot_ut_point = function () {
p = plot_ut_abstract() + geom_point(aes(size = p1remaining, colour = p1remaining))
@abznak
abznak / fried green tomatoes
Created December 30, 2010 04:44
How to make fried green tomatoes
can't find the original joke after 60s searching, so here's a rough reconstruction:
How to make fried green tomatoes
1) Select dark green tomatoes with no blemishes
2) Slice longitudinally into 2cm slabs
3) coat with a mixture of salt, flour and spices
4) deep fry for 2mins in oil at 200degC
5) bury result in back yard and buy a burger. Fried green tomatoes are nasty.
@abznak
abznak / ozymandias.txt
Created March 20, 2011 11:33
OZYMANDIAS by Percy Bysshe Shelley
OZYMANDIAS
by Percy Bysshe Shelley. via http://en.wikipedia.org/wiki/Ozymandias
I met a traveller from an antique land
Who said: Two vast and trunkless legs of stone
Stand in the desert. Near them, on the sand,
Half sunk, a shattered visage lies, whose frown
And wrinkled lip, and sneer of cold command
Tell that its sculptor well those passions read
Which yet survive, stamped on these lifeless things,
@abznak
abznak / floats.php
Created June 28, 2011 06:55
lesson - do not use floats for money
<?php
#don't use floats for money!
$a = 110; # $110
$b = 1.10 * 100; # 100 items at $1.10 each
#$b = 110 -1E-13;
print "a: "; var_dump($a);
print "b: "; var_dump($b);
<?php
$a = '1E1';
$b = $a - (int)$a;
var_dump($b);
//output: float(9)
@abznak
abznak / index.php
Created November 16, 2012 03:49
very quick image gallery script
<html><body>
<?php
$msg = file_get_contents('readme.txt');
echo "<pre>$msg\n\n</pre>";
foreach (glob("*") as $img) {
if (preg_match("/jpg|png|gif/i", $img)) {
echo "<img src=\"$img\"><br>";
}
}
@abznak
abznak / gist:7c392f92005ac3fceff3
Created June 23, 2014 05:44
on PHP and foreach by reference
04:46:58 tims@saw ~ $ cat test.php
<?php
$a = array(1,2,3,4);
#http://www.php.net//manual/en/control-structures.foreach.php
# "Warning Reference of a $value and the last array element remain even after the foreach loop. It is recommended to destroy it by unset()"
foreach ($a as &$b) {
$b = $b * 2;
}
Twitter won't let me send this tweet, it claims "This request looks like it might be automated. To protect our users from spam and other malicious activity, we can't complete this action right now. Please try again later."
I think this is the article on character encoding I'm looking for. #ruby
https://web.archive.org/web/20140807044211/http://graysoftinc.com/articles/ruby_19s_string
she told him that she loved him
only she told him that she loved him
she only told him that she loved him
only she only told him that she loved him
she told only him that she loved him
only she told only him that she loved him
she only told only him that she loved him
only she only told only him that she loved him
she told him only that she loved him
only she told him only that she loved him
@abznak
abznak / gist:33a63d0b5f017dd849f7d072e19a2ed9
Created May 18, 2016 05:31
assigning to nil as an array
15:23:14 tims@firebat ~ $ rvm use 2.2.1
Using /home/tims/.rvm/gems/ruby-2.2.1
15:23:18 tims@firebat ~ $ irb
2.2.1 :001 > "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
=> "2.2.1-p85"
2.2.1 :002 > a = nil
=> nil
2.2.1 :003 > a[5] = 6
NoMethodError: undefined method `[]=' for nil:NilClass
from (irb):3