Skip to content

Instantly share code, notes, and snippets.

View kn9ts's full-sized avatar
🌠
I am one with the force!

Eugene Mutai kn9ts

🌠
I am one with the force!
View GitHub Profile
@alecthegeek
alecthegeek / go-install-tools
Last active September 3, 2015 18:18
Set up a "standard" go project workspace with support for 3rdparty modules, version control repo and a template main package
# Install all the Go tools and godep tool
# Location of gobin is based on installation by OS X Homebrew
sudo -u admin GOPATH=/tmp GOBIN=/usr/local/opt/go/bin go get -u golang.org/x/tools/cmd/...
sudo -u admin GOPATH=/tmp GOBIN=/usr/local/opt/go/bin go get -u github.com/tools/godep
@wilr
wilr / app._config.routes.yml
Created September 15, 2012 00:29
Basic SilverStripe 3.0 Framework Bootstrap
---
Name: app
After: framework/routes#coreroutes
---
Director:
rules:
'dev': 'DevelopmentAdmin'
'sitemap.xml': 'GoogleSitemap'
'$Action' : 'BaseController'
@aaronsnoswell
aaronsnoswell / t.js
Created December 6, 2011 07:06
Tweet sized JS templating
// Via @thomasfuchs (http://mir.aculo.us/2011/03/09/little-helpers-a-tweet-sized-javascript-templating-engine/)
function t(s, d){
for(var p in d)
s = s.replace(new RegExp('{'+p+'}','g'), d[p]);
return s;
}
(function() {
var cache = {};
this.tmpl = function(str, data) {
cache[str] = cache[str] ||
new Function('data', [
'var _p="";\nwith(arguments[0]||{}){\n_p+="',
str.replace(/"/g, '\\$&')
.replace(/[\r\n]/g, '')
.replace(/<%([^\w\s\}\)]*)\s*(.*?)\s*%>/g, function(match, mark, code) {
if (mark === '=') return '"+(' + code + ')+"';
@MwirabuaTimothy
MwirabuaTimothy / grive-cron.sh
Last active January 15, 2017 18:38
Backup Latest MySQL Dumps Every Date of the Month to Google Drive
# Adapted from https://petermolnar.net/database-backups-to-google-drive/
# Works for linux systems
#
# 1. Install grive https://github.com/Grive/grive
#
# for ubuntu/debian use:
# $ sudo add-apt-repository ppa:nilarimogard/webupd8
# $ sudo apt-get update
# $ sudo apt-get install grive
#
@hubgit
hubgit / request-queue.js
Created February 20, 2014 17:38
JS Request queue
var queue = [
'https://peerj.com/articles/1.json',
'https://peerj.com/articles/2.json',
'https://peerj.com/articles/3.json',
];
var run = function() {
var xhr = new XMLHttpRequest;
xhr.open('GET', queue.shift());
xhr.responseType = 'json';
@slightlyoff
slightlyoff / push_api_sketch.md
Last active June 7, 2018 07:15
Service Worker + Push API

Motivation

The current Push API Draft specifies a system that has no notion of push channel persistence. Further, it does not include push message payloads, a feature that many developers want.

This gist outlines an API which:

  • integrates with the Service Worker to enable delivery of push messages to applications which do not have visible tabs
  • enables a JSON-formatted body of content
  • guards access to registration for pushes on potential user consent
@koba04
koba04 / .gitignore
Last active December 21, 2018 02:21
karma + mocha + browserify + babel + power-assert
node_modules/
@busypeoples
busypeoples / AngularJS-ES6-Test-Skeleton
Last active June 6, 2020 01:29
AngularJS - Karma, Jasmine, Browserify, Stringify - ES6 Test Setup
We couldn’t find that file to show.
@erichiggins
erichiggins / ndb_json.py
Last active May 23, 2021 00:27
JSON serializer/deserializer adapted for use with Google App Engine's NDB Datastore API. This script can handle Model, Expando, PolyModel, Query, QueryIterator, Key, datetime, struct_time, and complex types.
#!/usr/bin/env python
"""
JSON encoder/decoder adapted for use with Google App Engine NDB.
Usage:
import ndb_json
# Serialize an ndb.Query into an array of JSON objects.
query = models.MyModel.query()