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:7758256
Created December 2, 2013 20:35
Basic LESS compiler commands on slytrunk
// Tail node log
bdalziel@dev02:~$ sudo su
[sudo] password for bdalziel:
root@dev02:/home/bdalziel# tail -f /var/log/node/less.log
.. log ...
// Kill & restart process in background
bdalziel-air:~ bdalziel$ cd github/SlyTrunk/ios-shapeshuffle-v2/
bdalziel-air:ios-shapeshuffle-v2 bdalziel$ mkdir .git/info
bdalziel-air:ios-shapeshuffle-v2 bdalziel$ emacs .git/info/exclude
@bdalziel
bdalziel / gist:5032765
Created February 25, 2013 20:01
Simple JS for building a DOM tag containing the Pinterest data from the URL and loading the external Pinterest script to parse it.
YUI.add("muse-pin-it-button", function (Y) {
var isInit = false;
var putButtonMarkupOnPage = function () {
var urlParams = window.location.search.substr(1) + "";
var params = Y.QueryString.parse(urlParams);
var url = params.url;
var description = params.description;
var media = params.media;
Y.one('body').setContent('<a data-pin-config="beside" href="//pinterest.com/pin/create/button/?url=' + url + '&media=' + media + '&description=' + description + '" data-pin-do="buttonPin" ><img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" /></a>');
}
@bdalziel
bdalziel / gist:5032724
Created February 25, 2013 19:57
Dynamic Pinterest Button iFrame HTML
<html>
<head>
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js" type="text/javascript"></script>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
</style>
@bdalziel
bdalziel / gist:4046956
Created November 9, 2012 17:22
Sizing the zoom ratio
var sizeZoomRatio = function (gallery) {
var zoomBodyNode = gallery.one('.zoomBody');
var zoomBodyRatioNode = zoomBodyNode.one('.zoomBoundaryRatio');
zoomBodyRatioNode.addClass('nudging');
var imgWidth = Y.Util.getClassValue(zoomBodyRatioNode, 'imgW');
var imgHeight = Y.Util.getClassValue(zoomBodyRatioNode, 'imgH');
@bdalziel
bdalziel / gist:4021633
Created November 6, 2012 00:46
Zoom and position
var performZoomAndPositionImg = function (newZoomLevel) {
var zoomScaleContainer = Y.one('.fullScreenGallery .fullScreenExperience');
var zoomBoundary = zoomScaleContainer.one('.zoomBoundary');
var zoomImage = zoomBoundary.one('.zoomImg');
var oldLeftOffset = zoomImage.get('offsetLeft');
var oldTopOffset = zoomImage.get('offsetTop');
var oldImgHeight = zoomImage.get('offsetHeight');
var oldBoundaryHeight = zoomBoundary.get('offsetHeight');
@bdalziel
bdalziel / gist:4021436
Created November 6, 2012 00:18
Extended mixin to scale zoomed image
@boundaryScale: 2;
.zoomStep(@zoomFactor) {
@boundarySize: (@boundaryScale * @zoomFactor);
.zoomBoundary {
width: @boundarySize;
height: @boundarySize;
top: (0 - (@boundarySize - 100%)/2);
left: (0 - (@boundarySize - 100%)/2);
}
@imgPrimaryDimensionSize: ((100% + ((@boundarySize - 100%)/2)) / (@boundarySize/100));
@bdalziel
bdalziel / gist:4021373
Created November 6, 2012 00:15
Scaling the zoom boundary
.zoom-100 { .zoomStep(100%); }
.zoom-125 { .zoomStep(125%); }
.zoom-150 { .zoomStep(150%); }
.zoom-175 { .zoomStep(175%); }
.zoom-200 { .zoomStep(200%); }
.zoom-225 { .zoomStep(225%); }
.zoom-250 { .zoomStep(250%); }
.zoom-275 { .zoomStep(275%); }
.zoom-300 { .zoomStep(300%); }
@bdalziel
bdalziel / gist:4020397
Created November 5, 2012 21:20
Slide Body CSS
li.gallerySlide .slideBody {
height: 100%;
/* Total width = 100% with padding */
width: 80%;
padding-left: 5%; /* nudge selected slide in from left */
padding-right: 15%; /* PEEK */
overflow: auto; /* think vertical scroll bars with small browser height */
}
li.gallerySlide .assetWrap {