Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#
# Run Script
# wget -qO - "https://git.io/vUGQt" | sudo sh
# Edit Script
# wget -q --content-disposition "https://git.io/vUGQt"
#
set -e
@pward123
pward123 / snapcraft.yaml
Created September 13, 2017 09:07
Snap for NATS server + ws-tcp-relay
name: savi-nats-server
version: "1.0.2"
summary: "High-Performance server for NATS"
description: "High-Performance server for NATS, the cloud native messaging system"
confinement: strict
apps:
nats-server:
command: gnatsd-v1.0.2-linux-amd64/gnatsd
daemon: simple
@pward123
pward123 / list.js
Created February 17, 2017 16:41
tachyons list using styled-components
import React, { PropTypes } from 'react'
import styled from 'styled-components'
import t from 'tachyons-js'
export const List = ({
className,
children,
}) => (
<ul className={className}>
@pward123
pward123 / custom_parser.js
Created August 26, 2016 16:09
Jison Custom Scanner
import {Parser} from 'jison'
// tokens
const EOL = 'EOL' // End of line
const EOR = 'EOR' // End of record
const LEFT = 'x'
const TOP = 'y'
const WIDTH = 'c'
const HEIGHT = 'r'
const INVALID = 'INVALID'
@pward123
pward123 / form.js
Last active August 29, 2015 13:57 — forked from digilord/formGetter.coffee
getFormValues
/**
* Returns a hash of the form values for the form closest to the provided target
**/
getFormValues = function _getFormValues(target) {
var fields = $(target).closest('form').find(':input');
return _.reduce(fields, function(initial, field) {
var name = field.name;
if (name === '') return initial;
initial[name] = field.value.trim();
@pward123
pward123 / newBlockHelper.html
Last active August 29, 2015 13:57
Simple search panel block helper
<template name='editableList'>
<div class="panel panel-default search-panel">
<div class="panel-heading">
<span style="color:#428BCA;font-size:17px;line-height:19.5px">{{name}}</span>
<div class="panel-toolbar pull-right">
<form class="nav-search" style="right:40px;">
<span class="input-icon">
<input type="text" placeholder="Search ..." class="nav-search-input" autocomplete="off" name="search"/>
<i class="icon-search nav-search-icon"></i>
@pward123
pward123 / gist:9585236
Created March 16, 2014 15:50
Meteor pre-blaze "include" helper
// Taken from:
// https://github.com/wycats/handlebars.js/pull/385
// http://jsfiddle.net/QV9em/4/
//
// {{#each items}}
// {{#include section=..}}
// {{> sectionItem}}
// {{/include}}
// {{/each}}
Handlebars.registerHelper('include', function(options) {
@pward123
pward123 / session-property.js
Last active August 29, 2015 13:57
Session Trick
SessionProperty = function _sessionProperty(key, defaultValue) {
if (!_.isString(key)) throw new Meteor.Error('key must be a string');
return function(value) {
if (_.isUndefined(value)) {
value = Session.get(key);
return _.isUndefined(value) ? defaultValue : value;
} else {
return Session.set(key, value);
{
getItems: function() {
var future = new Future()
,onComplete = future.resolver()
,sequence = 0
,waitingOnReplies = []
,replies = []
,buffer = ''
,client
;
@pward123
pward123 / start
Last active August 29, 2015 13:56
Flambe: auto build/serve on .hx change
#!/usr/bin/env node
var spawn = require('child_process').spawn
,StringDecoder = require('string_decoder').StringDecoder
,build,serve
;
function logData() {
var i,len;
for (i = 0, len = arguments.length; i < len; i++) {