Skip to content

Instantly share code, notes, and snippets.

View jonathanlking's full-sized avatar

Jonathan King jonathanlking

View GitHub Profile
@nielsbot
nielsbot / README
Created February 25, 2012 02:31 — forked from PlacePop/README
Adds support for loading UIImage's from PDF files. I think it's a great way to add resolution-independent graphics to your apps, and also remove the "export to bitmap" step from your workflow. Just save directly from Illustrator!
Adds support for loading UIImage's from PDF files. I think it's a great way to add resolution-independent graphics to your apps, and also remove the "export to bitmap" step from your workflow. Just save directly from Illustrator!
What it does:
- You can pass the name of a PDF file (with or without the '.pdf') to +[UIImage imageNamed:]
- You can use the name of a PDF file inside Interface Builder, in your UIImageView's
- Turn a multi-page PDF into an array of UIImage's... good for animation.
Feedback to gists @nielsbot.com. Thanks!
@sterlingwes
sterlingwes / tourney.html
Created December 3, 2012 23:42
Tournament Bracket Generator (Javascript + CSS, no tables)
<!DOCTYPE html>
<html>
<head>
<title>Tournament Bracket Generator</title>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://underscorejs.org/underscore-min.js"></script>
<script>
$(document).on('ready', function() {
var knownBrackets = [2,4,8,16,32], // brackets with "perfect" proportions (full fields, no byes)
javascript:(function(e,a,g,h,f,c,b,d)%7Bif(!(f=e.jQuery)%7C%7Cg%3Ef.fn.jquery%7C%7Ch(f))%7Bc=a.createElement(%22script%22);c.type=%22text/javascript%22;c.src=%22http://ajax.googleapis.com/ajax/libs/jquery/%22+g+%22/jquery.min.js%22;c.onload=c.onreadystatechange=function()%7Bif(!b&&(!(d=this.readyState)%7C%7Cd==%22loaded%22%7C%7Cd==%22complete%22))%7Bh((f=e.jQuery).noConflict(1),b=1);f(c).remove()%7D%7D;a.documentElement.childNodes%5B0%5D.appendChild(c)%7D%7D)(window,document,%221.3.2%22,function($,L)%7B$('%23header,%20.pagehead,%20.breadcrumb,%20.commit,%20.meta,%20%23footer,%20%23footer-push,%20.wiki-actions,%20%23last-edit,%20.actions,%20.header').remove();%20$('%23files,%20.file').css(%7B%22background%22:%22none%22,%20%22border%22:%22none%22%7D);%20$('link').removeAttr('media');%7D);
@commadelimited
commadelimited / harlem-shake.js
Created February 15, 2013 02:38
Harlem Shake Bookmarklet deconstructed
javascript: (function () {
function c() {
var e = document.createElement("link");
e.setAttribute("type", "text/css");
e.setAttribute("rel", "stylesheet");
e.setAttribute("href", f);
e.setAttribute("class", l);
document.body.appendChild(e)
}
function h() {
@justincarroll
justincarroll / bootstrap-basic-template.htm
Last active May 11, 2018 04:43
This is my personal Bootstrap 3 and Font Awesome 4 basic HTML template.
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Basic Template</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css">
@burke
burke / remotepaste.md
Last active June 15, 2024 12:55
This sets up keybindings in tmux that allow you to copy/paste to/from your OS X clipboard from tmux running inside an SSH connection to a remote host. Partially borrowed from http://seancoates.com/blogs/remote-pbcopy

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>
@kenshin03
kenshin03 / gist:6303582
Last active April 21, 2019 06:25
Heartbeat like vibration with private API AudioServicesPlaySystemSoundWithVibration
NSMutableDictionary* pulsePatternsDict = [@{} mutableCopy];
NSMutableArray* pulsePatternsArray = [@[] mutableCopy];
// beat for 100 times
for (NSInteger i=0; i<100; i++){
[pulsePatternsArray addObject:@(YES)]; // vibrate for 100ms
[pulsePatternsArray addObject:@(100)];
[pulsePatternsArray addObject:@(NO)]; //stop for 1200ms * 0.3
[pulsePatternsArray addObject:@(1200*0.3)];
@plentz
plentz / nginx.conf
Last active June 11, 2024 06:55
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@johnnyclem
johnnyclem / iOS Camera - Highest Framerate
Last active May 18, 2018 05:32
this method sets the camera frame rate to the max available for the device
- (void)configureCameraForHighestFrameRate:(AVCaptureDevice *)device
{
AVCaptureDeviceFormat *bestFormat = nil;
AVFrameRateRange *bestFrameRateRange = nil;
for ( AVCaptureDeviceFormat *format in [device formats] ) {
for ( AVFrameRateRange *range in format.videoSupportedFrameRateRanges ) {
if ( range.maxFrameRate > bestFrameRateRange.maxFrameRate ) {
bestFormat = format;
bestFrameRateRange = range;
}
@efeciftci
efeciftci / strtok_example.c
Last active October 25, 2021 04:28
An example that shows usage of strtok function in C programming language.
/*
* The following description is from Linux Programmer's Manual (strtok(3)):
*
* #include <string.h>
* char *strtok(char *str, const char *delim);
*
* The strtok() function breaks a string into a sequence of zero or more
* nonempty tokens. On the first call to strtok() the string to be parsed
* should be specified in str. In each subsequent call that should parse
* the same string, str must be NULL.