Skip to content

Instantly share code, notes, and snippets.

View jameswyse's full-sized avatar
🏠
Codin'

James Wyse jameswyse

🏠
Codin'
View GitHub Profile
@jameswyse
jameswyse / ContentEditable Bookmarklet
Last active April 23, 2022 13:25
Bookmarklet to toggle ContentEditable
javascript:(function(e,n,o,t){o=e.body,t=%22true%22==o[n],o[n]=t%3F%22false%22:%22true%22,e.designMode=t%3F%22off%22:%22on%22})(document,%22contentEditable%22)
@jameswyse
jameswyse / html5video.sh
Created February 12, 2020 08:59
HTML5 Video Conversion Script
#!/bin/sh
# HTML5 Video Conversion Script
# Usage: ./html5video.sh file.mp4 640x360
#
# Requires FFMPEG 4.2+. To install on OSX:
#
# brew uninstall ffmpeg
# brew cask install xquartz
# brew install chromaprint amiaopensource/amiaos/decklinksdk
@jameswyse
jameswyse / async_app.py
Created March 21, 2017 10:37 — forked from zbyte64/async_app.py
Asyncio Views With Django
import asyncio
from django import http
from django.core.urlresolvers import set_script_prefix
from django.utils.encoding import force_str
from django.core.handlers.wsgi import get_script_name
from django_wsgi.handler import DjangoApplication
import logging
import logging
import sys

Keybase proof

I hereby claim:

  • I am jameswyse on github.
  • I am jameswyse (https://keybase.io/jameswyse) on keybase.
  • I have a public key whose fingerprint is 49C3 2DA9 6F4F 6ED5 7701 3FA3 3E58 B8A3 707E 9430

To claim this, I am signing this object:

@jameswyse
jameswyse / merge_asana_into_omnifocus.rb
Created April 28, 2016 02:38 — forked from hiltmon/merge_asana_into_omnifocus.rb
Updated Merge Asana into OmniFocus script
#!/usr/bin/env ruby -E utf-8
# merge_asana_into_omnifocus.rb
# Hilton Lipschitz
# http://www.hiltmon.com
# Use and modify freely, attribution appreciated
# Script to import Asana projects and their tasks into
# OmniFocus and keep them up to date from Asana.
@jameswyse
jameswyse / app.js
Created August 25, 2012 07:15
Express 3 locals
app.use(function(req, res, next) {
res.locals = {
keywords: config.app.meta_keywords,
description: config.app.meta_description,
url: url.parse(req.url).href
};
next();
};
@jameswyse
jameswyse / api_controller.js
Created June 22, 2012 12:45
Find postcodes within range of another postcode. Tags: NodeJS, MongoDB, Mongoose, RailwayJS, ExpressJS
// http://localhost:4000/api/postcodesNear?postcode=4101&range=2
action('postcodesNear', function () {
var earthRadius = 6378;
var qPostcode = req.query.postcode || 4101;
var qRange = Number(req.query.range) || 2;
Postcode .findOne({ 'postcode': qPostcode })
.run(function(err, postcode) {
if (err) send(err);
@jameswyse
jameswyse / example.styl
Created May 8, 2012 15:33 — forked from balupton/README.md
Responsive layouts in stylus
// Responsive layouts in stylus
// https://gist.github.com/1549029
// Created by Benjamin Lupton
// Licensed under the Creative Commons Zero - http://creativecommons.org/publicdomain/zero/1.0/
// ====================================
// Imports
// Nib
@import 'nib'
@jameswyse
jameswyse / PerchDB_MySQL.class.php
Created March 28, 2012 05:56
Perch ADODB MySQL Driver
<?php
include_once('adodb5/adodb.inc.php');
class PerchDB_MySQL
{
private $link = false;
private $errored = false;
static public $queries = 0;
private $enableCache = true;
@jameswyse
jameswyse / gist:2192568
Created March 25, 2012 09:35
Render markdown in node/express with variables
// You need to install 'node-markdown': `npm install node-markdown`
// In your app.configure section add 'md' to 'view options' ie:
app.set('view options', { layout: 'layouts/index', md: require("node-markdown").Markdown })
// Then in your jade template you can use:
div!=md(text)