This file contains 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
class Request : NSObject { | |
func send(url: String, f: (String)-> ()) { | |
var request = NSURLRequest(URL: NSURL(string: url)) | |
var response: NSURLResponse? | |
var error: NSErrorPointer = nil | |
var data = NSURLConnection.sendSynchronousRequest(request, returningResponse: &response, error: error) | |
var reply = NSString(data: data, encoding: NSUTF8StringEncoding) | |
f(reply) | |
} |
This file contains 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
<!DOCTYPE html> | |
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ --> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8" /> |
This file contains 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 saveImage($your_url, $width, $height, $file) { | |
$your_url = urlencode($your_url); | |
$url = 'http://chart.apis.google.com/chart?chs='.$width.'x'.$height.'&cht=qr&chl='.$your_url'; | |
// initialize cURL settings | |
$ch = curl_init ($url); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); |
This file contains 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
apt-get update | |
apt-get install -y php5 php5-cli php5-xdebug php5-mysql phpunit php-apc php5-imagick php5-mcrypt php5-memcache php5-suhosin php-pear curl imagemagick php5-dev php5-curl php5-sqlite phpmyadmin mysql-server libapache2-mod-php5 apache2 memcached vim git-core subversion |
This file contains 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/bash | |
# Simple script to backup MySQL databases | |
# Parent backup directory | |
backup_parent_dir="/var/backups/mysql" | |
# MySQL settings | |
mysql_user="root" | |
mysql_password="" | |
This file contains 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
<!DOCTYPE html> | |
<html lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<title>window.history.pushState Example</title> | |
</head> | |
<body> | |
<h1>window.history.pushState Example</h1> | |
This file contains 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 require_once('coreylib.php'); ?> | |
<?php if ($photos = coreylib('http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=[ENTER-API-KEY]&user_id=[ENTER-USER-ID]&format=rest')) { ?> | |
<ul> | |
<?php foreach($photos->get('photosets/photoset') as $photoset) { ?> | |
<a href="http://www.flickr.com/photos/[ENTER-USERNAME]/sets/<?php echo $photoset['id'] ?>"> | |
<img src="http://farm<?php echo $photoset['farm'] ?>.static.flickr.com/<?php echo $photoset['server'] ?>/<?php echo $photoset['primary'] ?>_<?php echo $photoset['secret'] ?>_s.jpg" /><br /> | |
<?php echo $photoset->get('title') ?></a> | |
</a> | |
<?php } ?> | |
</ul> |
This file contains 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 | |
class ExampleTest extends TestCase { | |
public function setUp() | |
{ | |
parent::setUp(); | |
DB::beginTransaction(); | |
} |
This file contains 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 | |
class QuickGit | |
{ | |
/** @var int */ | |
private $major = 1; | |
/** @var int */ | |
private $minor = 0; |
This file contains 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
/* | |
what it does: | |
Wraps objects to respond to data path strings separated by '/' | |
ex: vpFoo['path/to/0/property'] <= same as => foo.path.to[0].property | |
usage: | |
const foo = { | |
bar: 12, | |
something: [ | |
{ baz: 14 } | |
] |
OlderNewer