Skip to content

Instantly share code, notes, and snippets.


Shane Thacker shanebo

View GitHub Profile
shanebo / timeLeft.js
Last active Apr 11, 2020
Simple seconds to hh:mm:ss functions
View timeLeft.js
// this has a max of 24 hrs
const timeLeft = (secs) =>
new Date(secs * 1000)
.substr(11, 8)
.replace(/^([00:])*/g, '') || '0';
// this could be extended to include days
const timeLeft = (time) => {
const hrs = Math.floor(time / 3600);
View app.css
#app {
background-color: #aae;
shanebo / countries-with-states-provinces-regions
Created Jul 15, 2015
All countries with their states/provinces/regions in json
View countries-with-states-provinces-regions
var countries = {
"Afghanistan": [
shanebo / cordova.exec.shim.js
Created Jun 21, 2013
A cleaner PhoneGap/Cordova cordova.exec api.
View cordova.exec.shim.js
A cleaner PhoneGap/Cordova cordova.exec API:
native(plugin.action, args, success, fail);
plugin.action = dot plugin/action separated string
args = anything (optional)
success = function (optional)
fail = function (optional)
shanebo / console-output
Created May 11, 2013
RethinkDB homebrew install console logs related admin asset path issues.
View console-output
brew update && brew install rethinkdb -v
Already up-to-date.
==> Downloading
Already downloaded: /Library/Caches/Homebrew/rethinkdb-1.4.5.tgz
tar xf /Library/Caches/Homebrew/rethinkdb-1.4.5.tgz
==> ./configure --prefix=/usr/local/Cellar/rethinkdb/1.4.5
./configure --prefix=/usr/local/Cellar/rethinkdb/1.4.5
* Detecting system configuration
Bash: 3.2.48(1)-release
Operating System: Darwin
View gist:4680222
class Api::ShowsController < ApiController
caches_page :index
def index
@shows = Show.order('id ASC').all
index = {}
@shows.each do |show|
show.image = show.image_url(:large)
index[] = show
View brew_doctor.log
brew doctor
Your OS X is ripe for brewing.
Any troubles you may be experiencing are likely purely psychosomatic.
View brew_install_-v_v8cgi.log
brew install -v v8cgi
Also installing dependencies: memcached, libmemcached
==> Downloading
File already downloaded in /Users/shane/Library/Caches/Homebrew
/usr/bin/tar xf /Users/shane/Library/Caches/Homebrew/memcached-1.4.5.tar.gz
==> ./configure --prefix=/usr/local/Cellar/memcached/1.4.5
./configure --prefix=/usr/local/Cellar/memcached/1.4.5
checking build system type... i386-apple-darwin11.0.0
checking host system type... i386-apple-darwin11.0.0
checking target system type... i386-apple-darwin11.0.0