Skip to content

Instantly share code, notes, and snippets.

@jmnwong
jmnwong / ST2 Cycle Tabbing
Created June 28, 2013 15:24
Makes CTRL-Tab cycle tabs in order for Sublime Text.
Put in (Preferences -> Key Bindings - User):
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }
<ul>
<li ng-repeat="bar in filteredBars = (bars | filter:barFilter)">
{{bar.name}}
</li>
</ul>
<p ng-hide="filteredBars.length">Nothing here!</p>
@bryanjclark
bryanjclark / adn-createStreamAndMonitor
Created November 9, 2013 23:17
I'm trying to build a Python-based push notification process. Eventually, I'll host it on a Mac or on AWS, and send out push notifications through there. Here's my current working copy (I'll update it occasionally) in trying to build that python service.
import time
import json
import requests
from pprint import pprint
# Here's what I want running on the server. For now, I'm running it on my local machine.
# FIRST, WE NEED AN APP TOKEN
appTokenURL = 'https://account.app.net/oauth/access_token'
clientID = 'MY_CLIENT_ID'
@ericgj
ericgj / 0-description.md
Last active April 5, 2020 22:50
Implementing a REST workflow using JSON Schema, an example

Implementing a REST workflow using JSON Schema, an example

The problem domain

You are designing a document-control system. Users create and edit documents for publication. Documents can be draft, in review, on hold, in process, or published. Users have specific roles which determine which documents they have access to, and what they are permitted to do to the documents, as the documents move through the workflow. Some users are writers, others are editors.

Expressed in plain language, the rules are:

  • Writers can view their own documents regardless of status.
  • Writers can create new documents.
  • Writers can save new documents as draft, or to in review if certain information is included.
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
#EXTINF:-1,BBC - Radio 2
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
#EXTINF:-1,BBC - Radio 3
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-aac-lc-a/format/pls/vpid/bbc_radio_three.pls
#EXTINF:-1,BBC - Radio 4
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
#EXTINF:-1,BBC - Radio 5 live
@banterability
banterability / battery.coffee
Last active January 14, 2016 00:37
Get iPhone battery life over time from Reporter App's (http://www.reporter-app.com/) logs in Dropbox
async = require 'async'
fs = require 'fs'
{filter, flatten} = require 'underscore'
OBJ_C_EPOCH = 978307200
DROPBOX_DIR = #"<path to your dropbox folder >/Dropbox/Apps/Reporter-App/"
fs.readdir DROPBOX_DIR, (err, files) ->
throw new err if err?
dataFiles = filter files, (filename) -> /.json/.test filename
@dbreunig
dbreunig / ReporterSaveFileDescription.md
Last active January 22, 2021 16:07
A description of the data written to the Reporter App Dropbox save folder.

#Reporter Save File Schema

##The Reporter Export File

Reporter saves to your Dropbox account with plaintext JSON files, one for each day. When a Report is entered in the app a file is created for that day if it does not exist. Otherwise, the report is appended to the existing file. The save folder is located in 'Dropbox/Apps/Reporter-App/'.

Reporter save files are named according to the following convention:

YYYY-MM-DD-reporter-export.json
@cirrusUK
cirrusUK / iplayer
Last active April 27, 2024 06:36
Lists, Records and Streams BBC iPlayer TV and Radio programmes + other Programmes via 3rd-party plugins. Requires a UK IP
#!/usr/bin/env perl
#
# get_iplayer - Lists, Records and Streams BBC iPlayer TV and Radio programmes + other Programmes via 3rd-party plugins
#
# Copyright (C) 2008-2010 Phil Lewis
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.