Skip to content

Instantly share code, notes, and snippets.

@khigia
khigia / gist:673
Created July 22, 2008 06:10
Ocaml ternary search tree type
type 'a tst_t =
| E
| N of 'a tst_t * 'a tst_t * 'a tst_t * char * 'a option
# Calculate all the primes between 0 and the value specified
def primes(up_to)
prev = []
(2..up_to).select do |x|
max_p = Math.sqrt(x).truncate
if !prev.find { |y| y <= max_p ? x % y == 0 : break }
prev << x
end
end
end
#!ruby -Ku
class << (_ = × = 来週も見てくださいね! = 'ひだまりスケッチ×365 ')
def / x=/_/x
sub! /(.*)/, ''; print $1
self
end
def < x=/_/x
print open(caller.first.split(':').first).read.split(/\s/)[-2..-1].join(' ')
end
#!ruby -Ku
class << (_ = × = 来週も見てくださいね! = 'ひだまりスケッチ×365 ')
def / x=/_/x
sub! /(.*)/, ''; print $1
self
end
def < x=/_/x
print open(caller.first.split(':').first).read.split(/\s/)[-2..-1].join(' ')
end
class Test
end
html body * span.clear,html body * div.clear,html body * li.clear,html body * dd.clear{background:none;border:0;clear:both;display:block;float:none;font-size:0;list-style:none;margin:0;padding:0;overflow:hidden;visibility:hidden;width:0;height:0}.clearfix:after{clear:both;content:'.';display:block;visibility:hidden;height:0}.clearfix{display:inline-block}* html .clearfix{height:1%}.clearfix{display:block}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outline:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-col
@bastien
bastien / gist:704
Created July 22, 2008 07:51
Scroll to the bottom of an element using Prototype and Scriptaculous wokrs under Firefox and Safari (not tested under ie)
/* Scroll to the bottom of an element using Prototype and Scriptaculous
wokrs under Firefox and Safari (not tested under ie)
*/
function scrollToBottom(element)
{
var offset= window.innerHeight - $(element).getHeight() -10 ;
Effect.ScrollTo(element, {offset:-offset})
}
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:10.0f]
forKey:kCATransactionAnimationDuration];
theView.layer.opacity = 0.0;
[CATransaction commit];
# S3 Backup Task for MySQL & SQLite
# Assumes InnoDB tables
# If using MySQL database user needs the "reload" permission on the database (for --flush-logs in mysqldump)
#
# Stores files in Amazon S3 using the excellent AWS Gem: http://amazon.rubyforge.org/
# For information about Amazon S3: http://aws.amazon.com/s3
#
# Installation
# 1) Install AWS Gem
# 2) Enter your S3 Bucket, access_key_id and secret_access_key in this file