Skip to content

Instantly share code, notes, and snippets.

View johnknott's full-sized avatar
🎯
Focusing

John Knott johnknott

🎯
Focusing
View GitHub Profile
@lau
lau / simple_time_zone_list.ex
Last active April 15, 2021 07:41
Simple city to time zone mapping from Rails. As an Elixir map.
# Could be used for instance like this in Phoenix: <%= select f, :time_zone, SimpleTimeZoneList.mapping %>
defmodule SimpleTimeZoneList do
@mapping %{
"International Date Line West" => "Pacific/Midway",
"Midway Island" => "Pacific/Midway",
"American Samoa" => "Pacific/Pago_Pago",
"Hawaii" => "Pacific/Honolulu",
"Alaska" => "America/Juneau",
"Pacific Time (US & Canada)" => "America/Los_Angeles",
"Tijuana" => "America/Tijuana",
@leefsmp
leefsmp / snap-arc-demo.html
Last active June 21, 2020 02:16
SVG Arc Path Demo with Snap.svg
<!-- Written By Philippe Leefsma, Feb 2016 -->
<!DOCTYPE html>
<html>
<head lang="en">
<meta name="viewport" content="width=device-width, height=device-height, minimal-ui">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta charset="UTF-8">
<title>Snap SVG Arc Path Demo</title>
var Dialog = React.createClass({
render: function() {
// 1) render nothing, this way the DOM diff will never try to do
// anything to it again, and we get a node to mess with
return React.DOM.div();
},
componentDidMount: function() {
// 2) do DOM lib stuff
this.node = this.getDOMNode();
# {Rails.root}/shippable.yml
# shippleable example for rails 4 with mysql
language: ruby
rvm:
- 2.0.0
env:
- CI_REPORTS=shippable/testresults COVERAGE_REPORTS=shippable/codecoverage
@cryptix
cryptix / LICENSE
Last active March 10, 2024 09:55
example of using JWT for http authentication in go
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE S
var jsx = require('broccoli-react');
var browserify = require('broccoli-browserify');
var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');
var assets = pickFiles('app', {
srcDir: './',
files: ['**/*.html'],
destDir: './'
});
@geekle
geekle / makeiso.sh
Created January 19, 2014 00:27
Create bootable CoreOS ISO from the master PXE images.
#!/bin/bash
# Creates a bootable ISO from CoreOS' PXE images.
# Also adds a run script to the OEM partition and converts the ISO so it can boot from USB media.
# Based heavily off https://github.com/nyarla/coreos-live-iso - Thanks Naoki!
set -e
# Default configurations
SYSLINUX_VERSION="6.02"
@dwayne
dwayne / 1-introduction.md
Last active August 22, 2016 04:37
My notes from the book "Riding Rails with AngularJS by Ari Lerner".
@mattmccray
mattmccray / router.js
Last active December 26, 2015 14:29
Simple Backbone/Exoskeleton Router for use with React (http://facebook.github.io/react/)
var _missing= function(data){ return React.DOM.pre(null, "Route not found: "+ data.route) },
_router= null,
_started= false,
_nextId= 1;
function handleRouteChange(container, component) {
var routeParams= Array.prototype.slice.call( arguments, 1 )
React.renderComponent(
component({ routeParams:routeParams }, null),
container
@AlainODea
AlainODea / man2html-recursive.sh
Last active December 25, 2015 05:49
Use man2html to generate entire hyperlinked documentation from man pages
#!/bin/bash -e
#sudo apt-get -y install realpath man2html-base
#gem install ronn
#git clone git@github.com:joyent/illumos-joyent.git
#git clone git@github.com:joyent/smartos-live.git
pushd illumos-joyent
git pull
popd
pushd smartos-live
git pull