Skip to content

Instantly share code, notes, and snippets.

View bdalziel's full-sized avatar

Ben Dalziel bdalziel

View GitHub Profile
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
@bdalziel
bdalziel / gist:1571bb1d44419d5219f6
Created July 13, 2015 06:17
Some helpful links for App Transport Security in iOS 9
http://www.neglectedpotential.com/2015/06/working-with-apples-application-transport-security/
http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/
http://stackoverflow.com/questions/30739473/nsurlsession-nsurlconnection-http-load-failed-on-ios-9
https://github.com/AFNetworking/AFNetworking/issues/2779
@bdalziel
bdalziel / DoNotTryAndBeTooCleverWithinAnIteratorObject.php
Created July 25, 2011 20:42
Within an object implementing Iterator, be careful when using foreach($this as $foo) as opposed to foreach($this->items as $foo). If you're traversing a tree based on iteration in two directions through recursion, you can easily interfere with the interna
<?php
require_once 'SimpleIteratorNodeClasses.php';
class TryingToBeCleverNode extends SimpleNode {
public function getDepthOfDeepestChild () {
$max_depth = 'N/A';
var setupEllipsis = function(container, itemIndex, itemCount, maxItemCount) {
// Make everything visible
var hidden = container.all('li.hidden');
hidden.removeClass('hidden');
var ellipsis = container.all('li.ellipsis');
ellipsis.removeClass('ellipsis');
// Get the bounding box data for the selected item
var activePage = container.one('li.pageNum-'+itemIndex);
@bdalziel
bdalziel / gist:1235357
Created September 22, 2011 17:06
Ben's .emacs File
(add-to-list 'load-path "~/elisp")
(require 'php-mode)
(setq-default indent-tabs-mode nil);
(setq default-tab-width 4);
(setq c-basic-offset 4);
@bdalziel
bdalziel / gist:1235362
Created September 22, 2011 17:08
Ben's .bash_profile file
alias gobb='cd ~/dev/bbsites/trunk/;'
alias goww='cd ~/dev/bbsites/trunk/wonderwall/;'
alias gowwl='cd ~/dev/bbsites/trunk/wwlatino/;'
alias goglo='cd ~/dev/bbsites/trunk/glo/;'
alias gocom='cd ~/dev/bbsites/trunk/common/;'
alias gonfl='cd ~/dev/nfl/trunk/;'
alias gosly='cd ~/dev/sly/trunk/;'
alias gost='cd ~/dev/slytrunk/trunk/;'
$tag = "a tag to contain a list of cacheId";
$cacheId = "some key to cache";
if ( ! $keys = $this->_cache->load( $tag ) ) {
$keys = array( $cacheId );
$this->_cache->save( $keys, $tag );
}
else if ( ! in_array( $cacheId, $keys ) ) {
$keys[] = $cacheId;
$this->_cache->save( $keys, $tag );
@bdalziel
bdalziel / gist:2766645
Created May 22, 2012 04:44
styling fix
<style type="text/css">
input:not([type="image"]), textarea {
box-sizing: content-box;
}
</style>
@bdalziel
bdalziel / gist:3005501
Created June 27, 2012 17:19
Heavier handed flicker solution
ul * {
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
}
@bdalziel
bdalziel / gist:3005596
Created June 27, 2012 17:36
Rewrite YUI app transitions to use translate3d
stopTransitionsFlickering: function () {
var transDuration = 0.3;
var translateDistance = '100%';
Y.Transition.fx['app:fadeIn'] = {
opacity : 1,
duration: transDuration,
on: {
start: function (data) {
var styles = {opacity: 0},
config = data.config;