Skip to content

Instantly share code, notes, and snippets.

View jonathanlking's full-sized avatar

Jonathan King jonathanlking

View GitHub Profile
@jonathanlking
jonathanlking / NSInvocation Example
Created August 19, 2012 15:00
NSInvocation Example
//
// ViewController.m
//
//
// Created by Jonathan King on 19/08/2012.
//
//
#import "ViewController.h"
<?php
session_start();
// A really cool tool for debuging
/* require $_SERVER['DOCUMENT_ROOT'] . '/kint/Kint.class.php'; */
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$throws = $_POST['number'];
Josh
Buneme
Shaun
Dylan
Jonathan
Tycho
#include <SPI.h>
#include <ble.h>
#include <Servo.h>
#define LEFT_VIBRATOR_PIN 4
#define RIGHT_VIBRATOR_PIN 5
void setup()
{
SPI.setDataMode(SPI_MODE0);
<?php
function sendNotification($title,$body)
{
$AppKey = "YourUrbanAirshipAppKey";
$MasterSecret = "YourUrbanAirshipMasterSecret";
$request = curl_init();
curl_setopt($request, CURLOPT_URL, "https://go.urbanairship.com/api/push/");
curl_setopt($request, CURLOPT_USERPWD, "<$AppKey>:<$MasterSecret>");
@jonathanlking
jonathanlking / DeviceDetailViewController.m
Last active August 29, 2015 14:05
Ammmendments made to run UI changes on main thread using GCD
//
// DeviceDetailViewController.m
// MetaWearApiTest
//
// Created by Stephen Schiffli on 7/30/14.
// Copyright (c) 2014 MbientLab. All rights reserved.
//
// Amendments made to run UI changes on main thread using GCD by Jonathan King - 31/8/14
#import "DeviceDetailViewController.h"
#include <stdio.h>
#include <stdlib.h>
typedef enum type
{
CHAR,
INT,
LONG
} type;
@jonathanlking
jonathanlking / bs.sh
Last active August 29, 2015 14:27
This is a bash port of the Web Economy Bullshit Generator
#!/usr/bin/env bash
# This is a bash port of the Web Economy Bullshit Generator
# http://www.dack.com/web/bullshit.html
# Now you don't have to worry about commit messages!
ARRAY1=("implement" "utilize" "integrate" "streamline" "optimize" "evolve" "transform" "embrace"
"enable" "orchestrate" "leverage" "reinvent" "aggregate" "architect" "enhance" "incentivize" "morph" "empower"
"envisioneer" "monetize" "harness" "facilitate" "seize" "disintermediate" "synergize" "strategize" "deploy"
"brand" "grow" "target" "syndicate" "synthesize" "deliver" "mesh" "incubate" "engage" "maximize" "benchmark"
@jonathanlking
jonathanlking / dice.hs
Created September 14, 2015 14:04
Calculates the possible numbers that could be thrown by `n` dice, and the number of occurrences.
import Control.Monad
import Control.Arrow
import Data.List
dice :: Int -> [(Int, Int)]
dice = freq . map sum . (flip replicateM) [1..6]
freq :: Ord a => [a] -> [(a, Int)]
freq = map (head &&& length) . group . sort
@jonathanlking
jonathanlking / clean.hs
Last active April 20, 2016 13:56
For Linkload project
#!/usr/bin/env runhaskell
import System.Directory
import System.Environment
import Control.Monad
import System.FilePath.Windows
import Data.List
import Data.Maybe
type Name = String