Skip to content

Instantly share code, notes, and snippets.

Russell Beattie russellbeattie

Block or report user

Report or block russellbeattie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View router.js
export default class Router {
constructor(){
this.routes = [];
this.current = null;
}
add(route, handler) {
let re = new RegExp(route + '$');
@russellbeattie
russellbeattie / dwitterish.html
Last active Feb 22, 2017
Dwitter.net practice page
View dwitterish.html
<!DOCTYPE html>
<html>
<head>
<title>Dwitterish</title>
<style>
body{
background-color: #fff;
font-family: sans-serif;
}
.container{
@russellbeattie
russellbeattie / throttle.js
Last active Aug 18, 2016
A better, self-contained, JavaScript function throttle
View throttle.js
function throttle(fn, limit, scope) {
var last;
var deferTimer;
return function() {
var context = scope || this;
var args = arguments;
@russellbeattie
russellbeattie / search-apple-mail-body.js
Created Jun 1, 2016
Searches Apple mail Inbox for your name (if your name is Russ - otherwise change that bit) in the latest message and logs out/marks yellow.
View search-apple-mail-body.js
#!/usr/bin/env osascript -l JavaScript
function run(argv) {
var Mail = new Application("Mail");
var inbox = Mail.inbox();
var messages = inbox.messages();
@russellbeattie
russellbeattie / getfeed-nolibs.js
Created Dec 9, 2015
Just a quick library-free script to grab a feed and parse it
View getfeed-nolibs.js
var https = require('https');
var http = require('http');
var url = require('url');
var feedUrl = 'http://www.techmeme.com/feed.xml';
main();
function main(){
@russellbeattie
russellbeattie / aws-twitter-search-bot.js
Last active Jan 19, 2016
AWS Lambda Twitter Search Bot... uses S3 for persistence and SNS to send out messages.
View aws-twitter-search-bot.js
var querystring = require('querystring');
var https = require('https');
var aws = require('aws-sdk');
var s3 = new aws.S3();
var sns = new aws.SNS({
region: 'us-east-1'
});
var query = '#SEARCH TERM HERE';
@russellbeattie
russellbeattie / Dispatcher.js
Last active Nov 5, 2015
Clean version of Flux Dispatcher
View Dispatcher.js
/**
* Copyright (c) 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in
* https://github.com/facebook/flux/blob/master/LICENSE. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
@russellbeattie
russellbeattie / gist:11205288
Created Apr 23, 2014
Enabling remote debugging in apps using Cordova targeting Amazon Fire OS
View gist:11205288
package com.example.helloworld;
import android.os.Bundle;
import org.apache.cordova.*;
public class HelloActivity extends CordovaActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
View schema.go
package feeds
var Ns = map[string]string{
// via http://feed2.w3.org/docs/howto/declare_namespaces.html
"http://a9.com/-/spec/opensearch/1.1/": "opensearch",
"http://a9.com/-/spec/opensearchrss/1.0/": "opensearch10",
"http://backend.userland.com/blogChannelModule": "blogChannel",
"http://backend.userland.com/creativeCommonsRSSModule": "creativecommons",
"http://backend.userland.com/creativeCommonsRssModule": "creativeCommons",
You can’t perform that action at this time.