Skip to content

Instantly share code, notes, and snippets.

@sgen
sgen / gist:6b9c47ceb86fc7e7af82
Created May 20, 2015 14:08
Parsing custom name formats
const (
Full = "John Quincy Yang Public"
FirstAndLast = "John Quincy Yang"
LastFirstMiddleInitials = "Public, John Q. Y."
)
const (
firstName token = iota
@sgen
sgen / gist:184019c88584d4f85435
Created June 2, 2015 21:41
Polymer paper-toolbar example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Paper Toolbar Example</title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, user-scaleable=yes">
<script src="/ast/bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="/ast/bower_components/core-icon/core-icon.html">
<link rel="import" href="/ast/bower_components/paper-toolbar/paper-toolbar.html">
<link rel="import" href="/ast/bower_components/paper-icon-button/paper-icon-button.html">
@sgen
sgen / .jshintrc
Created July 24, 2015 16:22
.jshintrc
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
"node" : true,
@sgen
sgen / README.md
Last active November 1, 2015 19:29
Gulpfile.js for a Node.js module

The Ultimate Gulpfile

The ultimate gulpfile watches for changes to your .jsfiles and runs jshint, mocha tests and istanbul test coverage before launching 2 file servers serving jshint results and istanbul coverage respectively.

Usage

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/node_modules/angular-material/angular-material.min.css" type="text/css" />
</head>
<body ng-app="MyApp">
<script href="/node_modules/angular/angular.min.js"></script>
<script href="/node_modules/angular-animate/angular-animate.js"></script>
<script href="/node_modules/angular-aria/angular-aria.min.js"></script>
<script href="/node_modules/angular-material/angular-material.min.js"></script>
(function() {
angular.module('ToDoApp')
.controller('ToDoController', ['ToDoService', function(ToDoService) {
var ToDoController = this;
ToDoController.selected = null;
ToDoController.todos = [];
ToDoController.foo = 'Testing';
@sgen
sgen / gist:e00d68752006515fdf4c3e69163ab410
Created February 25, 2017 15:51
A Simple Mobile Nav
(function() {
'use strict';
function addClassIfNotPresent(e, c) {
console.log('addClassIFNotPresent');
console.log(e);
console.log(c);
var val = e.getAttribute('class');
if (val === null) {
e.setAttribute('class', c);
@sgen
sgen / _reset.scss
Created May 11, 2017 13:45
SCSS Reset
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html,
body,
div,
span,
applet,
@sgen
sgen / _reset.scss
Last active May 11, 2017 22:39
SCSS Reset
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
// scss-lint:disable single-line-per-selector
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p,
blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img,
ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i,
center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption,
@sgen
sgen / prompt.go
Created July 27, 2018 18:56
A basic prompt function in go
package main
import (
"fmt"
"os"
)
// prompt prompts the user for input, printing p to stdout and reading from
// stdin until a newline is read. If no value is read from stdin before a
// newline is found d is returned.