Skip to content

Instantly share code, notes, and snippets.

@johnpc
johnpc / Android Bluetooth Cordova
Created September 30, 2014 20:24
A cordova plugin that checks whether an android device has bluetooth activated
package org.apache.cordova.plugin;
import org.apache.cordova.api.CordovaPlugin;
import org.apache.cordova.api.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothAdapter;
@johnpc
johnpc / gist:c7d9c7731a556cd60f5f
Last active August 29, 2015 14:05
Working ordrin guest order request
require "ordrin"
my_secret_key = "PUT SECRET KEY HERE"
ordrin_api = Ordrin::APIs.new(my_secret_key, :test)
args = Hash.new
args["rid"] = '29900'
args["em"] = "john@johncorser.com"
args["tray"] = '25243987/1'
args["tip"] = "0.00"
args["first_name"] = "John"
args["last_name"] = "Corser"
@johnpc
johnpc / email based on google spreadsheet
Last active August 29, 2015 14:03
download google spreadsheet spreadsheet as csv and read through it, emailing someone when the record includes todays date
require 'mail'
require 'date'
require 'gdata/client'
require 'gdata/http'
require 'gdata/auth'
options = { :address => "smtp.gmail.com",
:port => 587,
:domain => 'your.host.name',
:user_name => '<username>',
@johnpc
johnpc / tmux.conf
Created June 8, 2014 16:37
This is a much more intuitive tmux.conf. Just rename it '.tmux.conf' and put it in your ~/
###############################
# _ #
# | |_ _ __ ___ _ ___ __ #
# | __| '_ ` _ \| | | \ \/ / #
# | |_| | | | | | |_| |> < #
# \__|_| |_| |_|\__,_/_/\_\ #
# #
###############################
############################################################################
import praw # simple interface to the reddit API, also handles rate limiting of requests
import re
from collections import deque
from time import sleep
USERNAME = "Your username here"
PASSWORD = "Your password here"
USERAGENT = "Your useragent string here. It should include your /u/username as a courtesy to reddit"
r = praw.Reddit(USERAGENT)