Skip to content

Instantly share code, notes, and snippets.

@Air-Craft
Air-Craft / jquery.plugin-template.js
Created October 20, 2011 10:56
jQuery Plugin Design Pattern/Template Improved!
// if (!window.L) { window.L = function () { console.log(arguments);} } // optional EZ quick logging for debugging
/**
* A modified (improved?) version of the jQuery plugin design pattern
* See http://docs.jquery.com/Plugins/Authoring (near the bottom) for details.
*
* ADVANTAGES OF EITHER FRAMEWORK:
* - Encapsulates additional plugin action methods without polluting the jQuery.fn namespace
* - Ensures ability to use '$' even in compat modes
*
@Air-Craft
Air-Craft / UIScrollView-velocity.m
Created July 25, 2014 15:09
Get scrolling velocity from a UIScrollView or UICollectionView #ios #intermediate #scrolling #physics
CGPoint scrollVelocity = [self.panGestureRecognizer velocityInView:self.superview];
if (scrollVelocity.y > 0.0f)
NSLog(@"going down");
else if (scrollVelocity.y < 0.0f)
NSLog(@"going up");
@Air-Craft
Air-Craft / GLSL-Wave-Equation.glsl
Created July 31, 2013 12:02
GLSL wave function give a 2D coordinate. Thanks: http://http.developer.nvidia.com/GPUGems/gpugems_ch02.html #wave #glsl #opengl #lib
#define VTXSIZE 0.80 // Amplitude
#define WAVESIZE 100.0 // Frequency
#define FACTOR 1.2
#define SPEED 2.0
#define OCTAVES 3
// Example of the same wave function used in the vertex engine
lowp float wave(lowp float x,
lowp float y,
lowp float timer)
@Air-Craft
Air-Craft / ffmpeg_from_m3u_stream.sh
Created December 24, 2015 13:29
Rip m3u8 stream (series of .ts files) to video via ffmpeg #video #conversion #streaming #ripping
ffmpeg -i "https://content.jwplatform.com/manifests/Wqyolfwt.m3u8" -c copy -bsf:a aac_adtstoasc video.mp4
@Air-Craft
Air-Craft / iphone_vibrate.m
Created April 26, 2015 13:55
Short custom vibration on iPhone #ios #vibration #private-api
// Headers
#import <AudioToolbox/AudioToolbox.h>
void AudioServicesStopSystemSound(SystemSoundID inSystemSoundID);
void AudioServicesPlaySystemSoundWithVibration(SystemSoundID inSystemSoundID,id arg,NSDictionary* vibratePattern);
// Buzz code
NSArray *vibe = @[ @YES, @10 ]; // ON for 10ms
NSDictionary *dict = @{ @"Intensity": @0.1, @"VibePattern": vibe };
AudioServicesPlaySystemSoundWithVibration(kSystemSoundID_Vibrate,nil,dict);
@Air-Craft
Air-Craft / Contract Killer 3.md
Created February 3, 2020 10:22 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@Air-Craft
Air-Craft / GLKViewController-with-CeedGL-Boilerplate.m
Created July 31, 2013 09:35
A GLKVC with frag and vertex shaders as files and with the CeedGL lib. Coord space mapped to 0,0...1,1. #glsl #opengl
/*******
*** vertex.glsl ***********
uniform mat4 u_projection_matrix;
attribute vec4 a_position;
//attribute vec4 a_source_color;
varying vec4 v_position;
void main(void)
{
"count":10,
"total_count":10,
"current_page":1,
"pages":1,
"products":[
{
"product":{
"id":1060500593,
@Air-Craft
Air-Craft / UIView+Marshmallows.h
Last active December 14, 2015 21:48
A UIView category of basic operations you kinda expect to be there but aren't. Contributions welcome!
#import <UIKit/UIKit.h>
@interface UIView (Marshmallows)
@property (nonatomic) CGFloat rotation;
/** @name Positioning convenience methods */
- (void)moveByDeltaX:(CGFloat)delX deltaY:(CGFloat)delY;
- (void)moveOriginToX:(CGFloat)theX;
- (void)moveOriginToY:(CGFloat)theY;
@Air-Craft
Air-Craft / css_browser_selector.php
Created November 29, 2011 11:12
PHP CSS Browser Selector
<?php
/*
PHP CSS Browser Selector v0.0.2 (Update by Hari Karam Singh)
Bastian Allgeier (http://bastian-allgeier.de)
http://bastian-allgeier.de/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Credits: This is a php port from Rafael Lima's original Javascript CSS Browser Selector: http://rafael.adm.br/css_browser_selector
*/