Skip to content

Instantly share code, notes, and snippets.


Alvin Liang aliang

View GitHub Profile
statico /
Last active Apr 27, 2021
Purple Air Sensor Plugin for BitBar
#!/usr/bin/env bash
# <bitbar.title>Purple Air PM2.5 AQI</bitbar.title>
# <bitbar.dependencies>bash,jq,node</bitbar.dependencies>
# Derived from by Chongyu Yuan
COLORS=("#0ed812" "#ffde33" "#ff9933" "#cc0033" "#660099" "#7e0023" "#404040")
montanaflynn / main.go
Last active Feb 16, 2021
Gin request timeout middleware and handler
View main.go
package main
import (
ryboe / .travis.yml
Last active Feb 20, 2021
Example .travis.yml for Golang
View .travis.yml
# use the latest ubuntu environment (18.04) available on travis
dist: bionic
language: go
# You don't need to test on very old versions of the Go compiler. It's the user's
# responsibility to keep their compiler up to date.
- 1.16.x
View app,assets,javascripts,static_resources.js
function requireAll(r) { r.keys().forEach(r); }
requireAll(require.context('../images/', true, /\..*$/));
requireAll(require.context('./vendors/', true, /\..*$/));
jamesmartin / application_controller.rb
Created May 25, 2015
Testing ApplicationController before_filter methods using RSpec's "anonymous" controller instance
View application_controller.rb
class ApplicationController < ActionControllerBase
helper :do_something
def do_something
@from_do_something = params[:for_do_something]
voter101 / Gulpfile.js
Last active Jun 20, 2019
Gulpfile for Rails application with replaced Sprockets with Gulp
View Gulpfile.js
'use strict'
var gulp, sass, babelify, browserify, watchify, source, util;
gulp = require('gulp');
sass = require('gulp-sass');
babelify = require('babelify')
browserify = require('browserify');
watchify = require('watchify');
source = require('vinyl-source-stream');
mikelehen / generate-pushid.js
Created Feb 11, 2015
JavaScript code for generating Firebase Push IDs
View generate-pushid.js
* Fancy ID generator that creates 20-character string identifiers with the following properties:
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
acolyer /
Last active Apr 14, 2021
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
pascalduez / SassMeister-input.scss
Last active Mar 6, 2021
Some Sass string functions: capitalize, ucwords, camelize, ...
View SassMeister-input.scss
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
// Capitalize string
// --------------------------------------------------------------------------------
// @param [string] $string
// --------------------------------------------------------------------------------
// @return [string]
dogoku / A
Last active May 1, 2020 — forked from tiffon/Find Results.hidden-tmLanguage
Search result syntax highlighting for Sublime Text
View A

#ST2/3 Search result syntax highlighting

##Introduction and disclaimer

This is gist contains an edited Find Results.hidden-tmLanguage which adds syntax highlighting to your ST search results. As far as I know, there is no plugin that does this and for that reason it needs to be done via config.

DISCLAIMER: Use this HACK at your risk and backup the original files you are about to mess with.

##Usage Guide for Sublime Text 2