Skip to content

Instantly share code, notes, and snippets.

Avatar

Jordan Dobson jordandobson

View GitHub Profile
@jordandobson
jordandobson / gist:0aebd3c5f67353714969
Created Jun 16, 2014
Clone a html node and make unique
View gist:0aebd3c5f67353714969
var clone = $(".cloneThisElement").clone().attr("id", "id-"+$.now());
@jordandobson
jordandobson / - Detect Resize
Last active Aug 29, 2015
Detect Resize and OS / Device Type
View - Detect Resize
$(window).bind('resize', function(){
var size = window.getComputedStyle(document.body,':after').getPropertyValue('content');
if (size.indexOf("break2") !=-1){
// Do stuff for breakpoint 2
} else if (size.indexOf("tablet") !=-1){
// Do stuff for tablet
View defaults and helper
# DEFAULTS #####################################################################################################
document.body.addEventListener('touchmove', (e) -> e.preventDefault() );
######################################################################################################################
# HELPER METHODS #####################################################################################################
######################################################################################################################
getComponent = (layer, parentLayer, opts) ->
c = layer.copy()
c.visible = true
View qc-framer.js
var QcValueConverter = {
tensionFromQcValue: function(qcValue) {
return (qcValue - 30.0) * 3.62 + 194.0;
},
qcValueFromTension: function(tension) {
return (tension - 194.0) / 3.62 + 30.0;
},
frictionFromQcValue: function(qcValue) {
@jordandobson
jordandobson / gist:852c4c6ef5e19966ee1a
Created Jun 10, 2015
Objective-c Apply Blending mode to an image
View gist:852c4c6ef5e19966ee1a
- (UIImage *)createDimImage:(UIImage *)image; {
CGSize size = image.size;
CGRect bounds = CGRectMake(0, 0,size.width, size.height);
UIImage * dimImage;
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f);
[msColorNeutralLight setFill];
UIRectFill(bounds);
[image drawInRect:bounds blendMode:kCGBlendModeMultiply alpha:1.0f];
View gist:e6b39f9454452a615960
- (UIView *)applyBlurToView:(UIView *)view withEffectStyle:(UIBlurEffectStyle)style andConstraints:(BOOL)addConstraints {
//only apply the blur if the user hasn't disabled transparency effects
if (!UIAccessibilityIsReduceTransparencyEnabled()) {
UIBlurEffect * blurEffect = [UIBlurEffect effectWithStyle:style];
UIVisualEffectView * blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
blurEffectView.frame = view.bounds;
[view addSubview:blurEffectView];
blurEffectView.layer.opacity = 0;
if (addConstraints) {
//add auto layout constraints so that the blur fills the screen upon rotating device
View application_controller.rb
# Three things to add:
# * before_filter call
# * action_has_layout? method (if you have one, combine them)
# * adjust_for_inline
#
class ApplicationController < ActionController::Base
# ...
before_filter :adjust_for_inline
View iphone-tethering.mdown

HOWTO: iPhone AT&T Tethering

In 10 steps:

  • Update iTunes to 8.2 via Software Update
  • Update your iPhone to the 3.0 release (out today - June 17th)
  • Download this dmg and mount it: tethering file
  • Enable hidden carrier testing option (in Terminal.app): defaults write com.apple.iTunes carrier-testing -bool TRUE
  • Start up iTunes
@jordandobson
jordandobson / form_help_bubble.html
Created Aug 12, 2009
An example of using a CSS+Unicode help bubble with an input field.
View form_help_bubble.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Help Bubble with CSS + Unicode + Input field</title>
<!--
Created by: Jordan Robert Dobson
JordanDobson@Gmail.com
@jordandobson
jordandobson / Help_Chat_bubble_with_css_and_unicode.html
Created Aug 12, 2009
A Help / Chat bubble using only CSS + Unicode. No Images needed!
View Help_Chat_bubble_with_css_and_unicode.html
<html>
<head>
<title>Help / Chat Bubble with CSS + Unicode</title>
<!--
Created by: Jordan Robert Dobson
JordanDobson@Gmail.com
http://MadeBySquad.com
http://twitter.com/JordanDobson