Skip to content

Instantly share code, notes, and snippets.

View shrunyan's full-sized avatar

Stuart Runyan shrunyan

View GitHub Profile
@shrunyan
shrunyan / bundle.js
Created October 21, 2015 21:23
Riot build with Gulp, Browserify, Riotify, Babel and gulp-connect
/* global require */
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer')
var browserify = require('browserify')
var watchify = require('watchify')
var riotify = require('riotify')
var babelify = require('babelify')
module.exports = function (gulp, plugins) {
@shrunyan
shrunyan / riot-todo-example.js
Last active October 21, 2015 17:47
Example of riot todo MVC
<todo>
<h3>TODO</h3>
<ul>
<li each={ item, i in items }>{ item }</li>
</ul>
<form onsubmit={ handleSubmit }>
<input type="text" />
<button>Add #{ items.length + 1 }</button>
</form>
@shrunyan
shrunyan / app.js
Last active January 7, 2017 14:40
Example Gulp build for Riotjs + ES6 + Browserify + Babelify + Riotify
import './app.tag'
riot.mount('#app', 'app')
@shrunyan
shrunyan / block-filter.css
Last active August 29, 2015 14:26 — forked from aarongustafson/block-filter.css
@supports IE TestDrive Code Samples
b {
background-color: red;
}
@media only screen {
b {
background-color: green;
}
b[class] {
background: linear-gradient( 0deg, rgb(65, 150, 44), rgb(26, 219, 73) );
@shrunyan
shrunyan / index.html
Last active August 29, 2015 14:26 — forked from benjchristensen/index.html
Simple Sparkline using SVG Path and d3.js
<html>
<head>
<title>Simple Sparkline using SVG Path and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
@shrunyan
shrunyan / gulpfile.js
Last active August 29, 2015 14:25 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@shrunyan
shrunyan / .vimrc
Last active August 29, 2015 14:24
My .vimrc file
" Make Vim more useful
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@shrunyan
shrunyan / zip-code-search.js
Last active August 29, 2015 14:22
Parsley code to iterate on a dataset and filter by GET parameters being posted to the file.
// zip-search-form.tpl
<input id="search" />
<ul id="results"></ul>
// zip-search-results.tpl
// template which generates results being returned to AJAX request
// % is the wildcard character in Parsley
{{each events as event WHERE event.zip_code LIKE '{get_var.term}%'}}
<li>
<h2>{{event.title}}</h2>
@shrunyan
shrunyan / jquery-form-post-capture.js
Last active August 29, 2015 14:22
jQuery script which will post a form to another url before posting to the default action attribute. Being used to capture a form lead submission to both the first party platform as well as Salesforce.
<script type="text/javascript">
// Using jQuery Library
$('#salesforce-form').one('submit', function(e) {
e.preventDefault();
var $form = $(this);
$.ajax({
url: '{{ page.getUrl() }}',
type: 'POST',
data: $form.serialize(),
success: function cb() {