Skip to content

Instantly share code, notes, and snippets.

View jarinudom's full-sized avatar

Jarin Udom jarinudom

View GitHub Profile
#!/usr/bin/env ruby
def tagz0r(char)
return char if char == " "
tagz0rz = %w{b i u s sub sup}.select{|c| rand(2) == 1}
colorz0r = %w{aqua black blue fuchsia magenta orange yellow cyan green lime purple red teal}[rand(13)]
sizez0r = (4..7).to_a[rand(4)]
fontz0r = ["Arial","Century Gothic","Book Antiqua","Comic Sans MS","Courier New","Fixedsys","Franklin Gothic Medium","Garamond","Impact","Lucida Console","System","Times New Roman","Trebuchet MS","Verdana"][rand(14)]
#!/usr/bin/env ruby
class Array
def rand
self[super(self.length)]
end
end
def tagz0r(char)
return char if char == " "
@jarinudom
jarinudom / gist:181605
Created September 6, 2009 02:07
Auto-Tune for Posts
#!/usr/bin/env ruby
# Usage: ./autotune.rb "sreegs ahuj9"
class Array
def rand
self[super(self.length)]
end
end
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Jarinheit - Jarin Udom's Blog</title>
<meta name="author" content="Jarin Udom" />
<link href="http://feeds.feedburner.com/jarinheit" rel="alternate" title="Jarinheit" type="application/atom+xml" />
<!-- syntax highlighting CSS -->
var urlString:String = "http://example.com/myfile.zip";
var urlReq:URLRequest = new URLRequest(urlString);
var urlStream:URLStream = new URLStream();
var fileData:ByteArray = new ByteArray();
urlStream.addEventListener(Event.COMPLETE, loaded);
urlStream.load(urlReq);
function loaded(event:Event):void {
urlStream.readBytes(fileData, 0, urlStream.bytesAvailable);
writeFile();
var urlString:String = "http://example.com/myfile.zip";
var urlReq:URLRequest = new URLRequest(urlString);
private var urlStream:URLStream = new URLStream();
private var fileStream:FileStream = new FileStream();
urlStream.addEventListener(Event.COMPLETE, loaded);
urlStream.addEventListener(ProgressEvent.PROGRESS, writeFile);
var file:File = File.desktopDirectory.resolvePath("myfile.zip");
fileStream.openAsync(file, FileMode.WRITE);
# config/environment.rb
config.gem 'mislav-will_paginate', :version => '~> 2.3.8', :lib => 'will_paginate',
:source => 'http://gems.github.com'
# config/environment.rb
config.gem 'will_paginate', :version => '~> 2.3.8',
:source => 'http://gemcutter.org'
# Should match (case insensitive):
# whatever.jpg
# WHATEVER.JPG
# folder/whatever.png
# Should not match:
# folder/__MACOSX/whatever.jpg
if !(entry.name =~ /__MACOSX/) && (entry.name.downcase =~ /\.(jpg|jpeg|png|gif)/)
#stuff
#!/usr/bin/env ruby
class Array
def rand
self[super(self.length)]
end
end
class String
def to_tag_s(tags)