Skip to content

Instantly share code, notes, and snippets.

View jordandobson's full-sized avatar
🥽

Jordan Dobson jordandobson

🥽
View GitHub Profile
@jordandobson
jordandobson / gist:0aebd3c5f67353714969
Created June 16, 2014 17:37
Clone a html node and make unique
var clone = $(".cloneThisElement").clone().attr("id", "id-"+$.now());
@jordandobson
jordandobson / - Detect Resize
Last active August 29, 2015 14:06
Detect Resize and OS / Device Type
$(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
# DEFAULTS #####################################################################################################
document.body.addEventListener('touchmove', (e) -> e.preventDefault() );
######################################################################################################################
# HELPER METHODS #####################################################################################################
######################################################################################################################
getComponent = (layer, parentLayer, opts) ->
c = layer.copy()
c.visible = true
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 June 10, 2015 22:18
Objective-c Apply Blending mode to an image
- (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];
@jordandobson
jordandobson / gist:e6b39f9454452a615960
Created June 11, 2015 00:11
Apply blur to a view
- (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
# 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

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 August 12, 2009 20:43
An example of using a CSS+Unicode help bubble with an input field.
<!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 August 12, 2009 20:28
A Help / Chat bubble using only CSS + Unicode. No Images needed!
<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