Skip to content

Instantly share code, notes, and snippets.

@Sneagan
Sneagan / airpod_availability.html
Last active Jan 2, 2017 — forked from blach/airpod_availability.html
Checks AirPod store availability by using JavaScript to query Apple's servers. Created with Textastic and works great with its built-in web preview. Uses YQL and JSONP to work around JavaScript's same origin policy. Inspired by https://gist.github.com/omarshahine/f8eb4598af4f1767ab1a9f01662e74b1
View airpod_availability.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<title>Check AirPod availability in Apple Stores</title>
<style>
body {
font-size: 12px;
@Sneagan
Sneagan / keybase.md
Last active May 30, 2016
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am sneagan on github.
  • I am sneagan (https://keybase.io/sneagan) on keybase.
  • I have a public key ASCMyJY5fF0dq3JDWO6fOxsRXnlALV1rw2n8p5wHK6Ns8wo

To claim this, I am signing this object:

@Sneagan
Sneagan / example.js
Created Feb 5, 2014
ADN Authorization Code POST Request
View example.js
app.get('/success', function(req, res){
var postFunction = function(reqq) {
var access_token = reqq.query.code;
var post_data = querystring.stringify({
'client_id': 'client_id',
'client_secret': 'client_secret',
'grant_type': 'authorization_code',
'redirect_uri': 'http://127.0.0.1:3000/',
'code': access_token
});
@Sneagan
Sneagan / to_camel_case.js
Last active Apr 19, 2016
Javascript function to recursively convert all keys in a Javascript object from underscore_naming to camelCase. This includes nested objects and objects within nested arrays.
View to_camel_case.js
var ConvertKeysToCamelCase = function(item_to_convert) {
var stringToCamelCase = function(string_to_convert) {
return string_to_convert.replace(/-([a-z])/g, function (g) {return g[1].toUpperCase();});
};
var convertKey = function(key_to_convert, key_to_replace) {
if (key_to_convert.indexOf('_') != -1) {
key_to_convert = key_to_convert.replace(/_/g,'-');
key_to_convert = stringToCamelCase(key_to_convert);
item_to_convert[key_to_convert] = item_to_convert[key_to_replace];
delete item_to_convert[key_to_replace];
@Sneagan
Sneagan / rss-subscribers.sh
Last active Sep 4, 2016 — forked from marcoarment/rss-subscribers.sh
Podcast-oriented bash script to parse Apache log for a count of RSS subscribers and podcatchers. Currently supports Instacast, Downcast, Podcasts, and the Instacast and iTunes indexers. Emails returned data and writes it to a CSV log file. Based on @marcoarment's RSS Subscriber bash script.
View rss-subscribers.sh
#!/bin/bash
# --- Required variables ---
RSS_URI="/your/rss/file"
MAIL_TO="your@email.com"
LOG_FILE="/your/log/file"
# Log that subscriber numbers will be written to. You will have to create one.
SUBSCRIBER_LOG="/place/to/log/subs"
You can’t perform that action at this time.