Skip to content

Instantly share code, notes, and snippets.

View betawax's full-sized avatar

Holger Weis betawax

  • Germany
View GitHub Profile
@betawax
betawax / gist:8839887
Created February 6, 2014 07:44
Measure the duration of a request
time curl -s -o /dev/null http://foobar.com
@betawax
betawax / gist:9320612
Created March 3, 2014 08:16
Bootstrap media queries
/* Phones, less than 768px */
.default {}
/* Tablets, 768px and up */
@media (min-width: 768px) {}
/* Desktops, 992px and up */
@media (min-width: 992px) {}
/* Large desktops, 1200px and up */
@betawax
betawax / gist:b784ae0449b6760980b2
Created May 5, 2014 17:16
View Controller Transition
CATransition *transition = [CATransition animation];
transition.duration = 0.35;
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromTop;
[self.view.window.layer addAnimation:transition forKey:kCATransition];
@interface FOOGradientLayer : NSObject
+ (CAGradientLayer *)gradientLayer;
@end
@implementation FOOGradientLayer
+ (CAGradientLayer *)gradientLayer {
@betawax
betawax / gist:c551521698b67ed225f7
Created June 10, 2014 06:23
Swift object initializer
init() {
// Set self properties
// Call super.init()
// Set super properties
}
@betawax
betawax / gist:bd7b84ef8cb111b090a7
Created June 25, 2014 06:16
Repeating try / catch block
$sleep = 1;
$attempts = 3;
for ($attempt = 0; $attempt < $attempts; $attempt++)
{
try
{
// ...
}
@betawax
betawax / gist:269a0963218932c388b2
Created September 9, 2014 07:30
Extract a single value from MySQL in Shell
FOOBAR=$(mysql -u [user] [database] -p[password] --skip-column-names -se "SELECT foo FROM bar;")
@betawax
betawax / gist:5470ec01b714e3e42725
Created September 18, 2014 07:58
Prefetch a site
wget -r -l 1 -nd -T 1200 --delete-after <URL>
@betawax
betawax / robots.txt
Created September 30, 2014 08:04
Disallow robots
User-agent: *
Disallow: /
@betawax
betawax / gist:d1d27f6234c8c6b1e3b8
Created September 30, 2014 08:03
WordPress address constants
define('WP_SITEURL', 'http://example.com');
define('WP_HOME', 'http://example.com');