Skip to content

Instantly share code, notes, and snippets.

View robinnorth's full-sized avatar
:octocat:

Robin North robinnorth

:octocat:
View GitHub Profile
@nicoverbruggen
nicoverbruggen / CDVCommandQueue.m
Last active August 29, 2015 13:57
Cordova iOS 7.0/7.1 optimizations. Also fixes for 7.1 arm64 crashes in plugins in CordovaLib < 3.5. Also includes fix for no splash screen on iPhone with 3.5" screen.
// Fix for BAD_ACCESS on arm64 devices
// Per this diff: https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git;a=blobdiff;f=CordovaLib/Classes/CDVCommandQueue.m;h=1eddfe37ee699289701cd4caaf68486607010501;hp=902dfa0227f1358296d2218fa0e6d5cc2a882ea6;hb=82ce4f2;hpb=7da5f2df3417de68a1b540bc00c11a95ce3dc7d6
// Should be fixed in CordovaLib 3.5
SEL normalSelector = NSSelectorFromString(methodName);
if ([obj respondsToSelector:normalSelector]) {
// [obj performSelector:normalSelector withObject:command];
((void (*)(id, SEL, id))objc_msgSend)(obj, normalSelector, command); // replace the old line with this one
} else {
// There's no method to call, so throw an error.
@brianleroux
brianleroux / lawnchair-examples.js
Created January 27, 2011 06:32
examples for using lawnchair js
// create a new store
var store = new Lawnchair({adaptor:'dom', table:'people'});
// saving documents
store.save({name:'brian'});
// optionally pass a key
store.save({key:'config', settings:{color:'blue'}});
// updating a document in place is the same syntax
@gerad
gerad / console-stub.js
Created February 29, 2012 18:55
stub out the javascript console for IE
!function(w) {
debugger
if (!w.console) {
var c = w.console = {};
c.log = c.error = c.info = c.debug = c.warn = c.trace = c.dir = c.dirxml = c.group = c.groupEnd = c.time = c.timeEnd = c.assert = c.profile = c.profileEnd = function() {};
}
}(window);
@jasonclark
jasonclark / social-media-share-markup
Last active January 27, 2017 15:43
Minimum viable social metadata markup - opengraph and twitter; Based on: https://dev.twitter.com/cards/getting-started#opengraph
<meta property="og:title" content="EmbedThis (Oembed)"/>
<meta property="og:description" content="Utility app that checks for an Oembed endpoint & returns HTML embed code."/>
<meta property="og:image" content="http://www.lib.montana.edu/~jason/files/oembed-this/meta/img/share-code-small.png"/>
<meta property="og:url" content="http://www.lib.montana.edu/~jason/files/oembed-this/index.php"/>
<meta property="og:type" content="website"/>
<meta name="twitter:creator" property="og:site_name" content="@jaclark"/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="http://www.jasonclark.info"/>
@robinnorth
robinnorth / bash_cheat-sheet.sh
Created April 15, 2013 08:25
Bash: Cheat sheet
# chmod all files in directory, including .hidden files
chmod [MODE] .[a-zA-Z0-9_]*
# create gzipped tarball, preserving permissions
tar -c -p -v -z -f /home/example/www.example.com_site-2013-04-15.tar.gz -C /home/example/ .
# Recursively chmod only directories
find . -type d -exec chmod 755 {} \;
# Similarly, recursively set the execute bit on every directory
@andrewlkho
andrewlkho / gist:10739376
Last active December 24, 2018 16:57
Clean URLs on jekyll/Apache

This was originally posted on 2011-07-11 to http://andrewho.co.uk/weblog/clean-urls-on-jekyll-apache

I use a static site generator, specifically [jekyll][], to transform some templates into a set of static *.html files. However, I like to keep the URLs looking clean, and not display the .html extension both because I think it looks better and also so that the URLs purely reflect the content and not the underlying files or CMS used to serve that content. In short, whilst the file being served might be $DOCUMENT_ROOT/weblog/title.html, the canonical URL for that resource should be /weblog/title. Here's how I do that in .htaccess.

@almaris
almaris / UGuiTextToTextMeshPro.cs
Last active January 28, 2019 10:07 — forked from Naphier/UGuiTextToTextMeshPro.cs
Unity3D Editor Tool to convert Unity GUI Text objects to Text Mesh Pro Text Objects
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using TMPro;
using TMPro.EditorUtilities;
//original gist at https://gist.github.com/Naphier/df8b56b8b879b6f33ec4eea8e98840b9
public class UGuiTextToTextMeshPro : Editor
{
[MenuItem("GameObject/UI/Convert To Text Mesh Pro", false, 4000)]
@maettig
maettig / LICENSE.txt
Created February 3, 2012 16:02 — forked from 140bytes/LICENSE.txt
isValidEan13 in 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Thiemo Mättig <http://maettig.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#!/bin/bash -x
CALLERS_UID="$1"
REFCOUNT_PATH="$2"
DCALL_PATH="$3"
if [ $UID -ne 0 ]; then
# Test that the script is run as root.
echo "Script must run as root"
exit 1
@roboshoes
roboshoes / touchmouse.js
Created April 13, 2012 10:43
This snippet maps mouse events and touch events onto one single event. This makes it easier in the code since you have to listen to only one event regardles whether it's desktop or mobile.
(function() {
/* == GLOBAL DECLERATIONS == */
TouchMouseEvent = {
DOWN: "touchmousedown",
UP: "touchmouseup",
MOVE: "touchmousemove"
}
/* == EVENT LISTENERS == */