Skip to content

Instantly share code, notes, and snippets.

View wayneseymour's full-sized avatar
💭
ABC...always be coding :)

Tre' wayneseymour

💭
ABC...always be coding :)
View GitHub Profile
@wayneseymour
wayneseymour / git-init.md
Created April 10, 2014 10:32
git init stuff

Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/wayneseymour/tk.git
git push -u origin master
cat input_file | sed 's/^..//' > output_file
@wayneseymour
wayneseymour / get-and-set.js
Last active August 29, 2015 14:00
Property Getters and Setters in JS.
// This object generates strictly increasing serial numbers
var serialnum = {
// This data property holds the next serial number.
// The $ in the property name hints that it is a private property.
$n: 0,
// Return the current value and increment it
get next() {
return this.$n++;
},
// Set a new value of n, but only if it is larger than current
@wayneseymour
wayneseymour / es5.js
Last active August 29, 2015 14:00
Immutable class w/ read only props
// This function works with or without 'new': a constructor and factory function
function Range(from,to) {
// These are descriptors for the read-only from and to properties.
var props = {
from: {value:from, enumerable:true, writable:false, configurable:false},
to: {value:to, enumerable:true, writable:false, configurable:false}
};
if (this instanceof Range) // If invoked as a constructor
Object.defineProperties(this, props); // Define the properties
else // Otherwise, as a factory
@wayneseymour
wayneseymour / .vimrc
Created April 27, 2014 11:20
Archive of my vim conf as os 4/27/2014
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
"
  1. Download [jshint.vim][jshint]

  2. Put it in ~/.vim/plugin/jshint.vim

  3. Edit your local vimrc file (I'm on macvim with janus, so it's at ~/.gvimrc.local) and add:

    au BufWritePost *.js :JSHint
  4. Read the [vim docs][vim] and particularly [auto commands][auto] I'm a newb and the neckbeards are probably laughing at me for even posting this.

  1. Download [jshint.vim][jshint]

  2. Put it in ~/.vim/plugin/jshint.vim

  3. Edit your local vimrc file (I'm on macvim with janus, so it's at ~/.gvimrc.local) and add:

    au BufWritePost *.js :JSHint
  4. Read the [vim docs][vim] and particularly [auto commands][auto] I'm a newb and the neckbeards are probably laughing at me for even posting this.

@wayneseymour
wayneseymour / index.js
Created June 2, 2014 11:40
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
### you have ctags but it does not work...
```shell
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
```
### you need to get new ctags, i recommend homebrew but anything will work
```shell
$ brew install ctags
#!/bin/bash
# Recursively add line feed to .js files that need it
# Usage: $ ./fix-line-endings.sh DIRECTORY_TO_RECURSE
function traverse() {
for file in $(ls "$1")
do
#current=${1}{$file}