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
<?php | |
if(isset($_REQUEST['name'])) { | |
// echo "Setting cookie..."; | |
if(!setcookie($_REQUEST['name'],$_REQUEST['value'],time() + $_REQUEST['exp'])) { | |
echo "ERROR: cookie not set!"; | |
} | |
} | |
?> | |
<html> | |
<head> |
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/env ruby -wKU | |
letters_only = /^[a-z]+$/i | |
phone_number = /^\(\d{3}\)\s?\d{3}-\d{4}$/ | |
numbers_below_18 = /^(([0-1]?[0-8])|(-\d*))$/ | |
html_tag = /^<([A-Z]*)>(.*)<\/\1>$/ | |
print "Input text: " | |
input = gets.strip | |
until input == "quit" do | |
puts case input |
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
// JQUERY AJAX FUNCTIONALITY | |
// Added by Jason Larsen | |
// 06 May 2010 | |
// adds .ajax and .ajax_node classes | |
// .ajax will load any page via ajax | |
// .ajax_node will load the drupal node at the specified href (loads only content) | |
// | |
// to implement, simply give the desired element the class of either ajax, or ajax_node, | |
// and include a href tag with the desired URL |
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
NSURL *url = [NSURL URLWithString:@"pinit12://pin/create/bookmarklet/?media=http%3A%2F%2Fimages.apple.com%2Fhome%2Fimages%2Fipad_hero.jpg&url=http%3A%2F%2Fwww.apple.com%2F&title=Apple&is_video=false&description=Test"]; | |
[[UIApplication sharedApplication] openURL:url]; |
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
[self.fullscreenButton customViewButtonWithImage:@"fullscreenButton" target:self action:@selector(toggleFullScreen:)]; |
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
// UISegmented control | |
UIImage *segSelected = [[UIImage imageNamed:@"sel.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)]; | |
UIImage *segUnselected = [[UIImage imageNamed:@"uns.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)]; | |
UIImage *segSelectedUnselected = [UIImage imageNamed:@"sel-uns"]; | |
UIImage *segUnselectedSelected = [UIImage imageNamed:@"uns-sel"]; | |
UIImage *segUnselectedUnselected = [UIImage imageNamed:@"uns-uns"]; | |
[[UISegmentedControl appearance] setBackgroundImage:segUnselected | |
forState:UIControlStateNormal | |
barMetrics:UIBarMetricsDefault]; |
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
~ % brew install netpbm | |
==> Downloading http://sourceforge.net/projects/netpbm/files/super_stable/10.35.86/netpbm-10.35.86.tgz | |
Already downloaded: /Library/Caches/Homebrew/netpbm-10.35.86.tgz | |
/usr/bin/tar xf /Library/Caches/Homebrew/netpbm-10.35.86.tgz | |
==> cp Makefile.config.in Makefile.config | |
cp Makefile.config.in Makefile.config | |
==> make | |
make | |
/private/tmp/brew-netpbm-10.35.86-LQva/netpbm-10.35.86/Makefile.common:560: Makefile.depend: No such file or directory | |
cat /dev/null >Makefile.depend |
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
foo = %w{cat dog dog cat cat cat dog cat dog dog cat cat dog dog} | |
bar = %w{yes no yes yes yes no no yes no yes no no yes yes} | |
puts "Foo: #{foo}" | |
puts "Bar: #{bar}" | |
histogram = foo.inject(Hash.new(0)) { |h,v| h[v] += 1; h } | |
puts histogram |