Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View watzon's full-sized avatar
👀
Looking for work

Chris Watson watzon

👀
Looking for work
View GitHub Profile
@watzon
watzon / tlds
Created May 29, 2015 16:42
Pipe separated list of TLD's
ABB|ABBOTT|ABOGADO|AC|ACADEMY|ACCENTURE|ACCOUNTANT|ACCOUNTANTS|ACTIVE|ACTOR|AD|ADS|ADULT|AE|AERO|AF|AFL|AG|AGENCY|AI|AIG|AIRFORCE|AL|ALLFINANZ|ALSACE|AM|AMSTERDAM|AN|ANDROID|AO|APARTMENTS|AQ|AQUARELLE|AR|ARCHI|ARMY|ARPA|AS|ASIA|ASSOCIATES|AT|ATTORNEY|AU|AUCTION|AUDIO|AUTO|AUTOS|AW|AX|AXA|AZ|BA|BAND|BANK|BAR|BARCLAYCARD|BARCLAYS|BARGAINS|BAUHAUS|BAYERN|BB|BBC|BBVA|BD|BE|BEER|BERLIN|BEST|BF|BG|BH|BI|BID|BIKE|BINGO|BIO|BIZ|BJ|BLACK|BLACKFRIDAY|BLOOMBERG|BLUE|BM|BMW|BN|BNPPARIBAS|BO|BOATS|BOND|BOO|BOUTIQUE|BR|BRIDGESTONE|BROKER|BROTHER|BRUSSELS|BS|BT|BUDAPEST|BUILD|BUILDERS|BUSINESS|BUZZ|BV|BW|BY|BZ|BZH|CA|CAB|CAFE|CAL|CAMERA|CAMP|CANCERRESEARCH|CANON|CAPETOWN|CAPITAL|CARAVAN|CARDS|CARE|CAREER|CAREERS|CARS|CARTIER|CASA|CASH|CASINO|CAT|CATERING|CBN|CC|CD|CENTER|CEO|CERN|CF|CFA|CFD|CG|CH|CHANNEL|CHAT|CHEAP|CHLOE|CHRISTMAS|CHROME|CHURCH|CI|CISCO|CITIC|CITY|CK|CL|CLAIMS|CLEANING|CLICK|CLINIC|CLOTHING|CLUB|CM|CN|CO|COACH|CODES|COFFEE|COLLEGE|COLOGNE|COM|COMMUNITY|COMPANY|COMPUTER|CONDOS|CONSTRUCTION|CONSULTING|CONTRAC
@watzon
watzon / keycodes.js
Created November 4, 2015 19:46
Javascript Keycode Map
var keyCodeMap = {
32: ' ',
48: '0',
49: '1',
50: '2',
51: '3',
52: '4',
53: '5',
54: '6',
55: '7',
"use strict";
let mongo = require('mongoose'),
Schema = mongo.Schema;
let schema = Schema.new({
name: String,
_date_added: Date.now(),
_date_updated: Date.now()
});
@watzon
watzon / date_range.rb
Created December 25, 2015 00:31
Ruby date range
require 'date'
((Date.today-7)..(Date.today)).each do |date|
puts date
end
@watzon
watzon / range.rb
Created December 25, 2015 03:51
Take ruby date range and see if any values from an array match values in the range
require 'date'
range = (Date.today-7)..(Date.today)
dates = ['2015-12-02','2015-12-03','2015-12-14','2015-12-19','2015-12-21','2015-12-23']
dates.each do |date|
date = Date.parse(date)
if range.include?(date)
puts date
@watzon
watzon / reg.js
Created January 7, 2016 00:46
Javascript regex for capturing parts of a URL
var exp = /(?:(https|http|ftp)\:\/\/)?(?:([\w\d\_\-\.]{1,256})\.)?([\w\d\_\-]{1,256})(?:\.([\w\.]{2,6}))(?:\/([\w\d\_\-\.\:\/\\]+))?(?:\?([\w\d\_\-\=\&]+))?(?:\#([\w\d\D]+))?/g
@watzon
watzon / css-selectors.js
Created January 12, 2016 22:40
Array of CSS 2.1 selectors
selectors = [ 'azimuth', 'background-attachment', 'background-color', 'background-image', 'background-position', 'background-repeat', 'background', 'border-collapse', 'border-color', 'border-spacing', 'border-style', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style', 'border-width', 'border', 'bottom', 'caption-side', 'clear', 'clip', 'color', 'content', 'counter-increment', 'counter-reset', 'cue-after', 'cue-before', 'cue', 'cursor', 'direction', 'display', 'elevation', 'empty-cells', 'float', 'font-family', 'font-size', 'font-style', 'font-weight', 'font-variant', 'font', 'height', 'left', 'letter-spacing', 'line-height', 'list-style-image', 'list-style-type', 'list-style', 'margin-right', 'margin-left', 'margin-top', 'margin-bottom', 'margin', 'max-height', 'max-width', 'min-height', 'min-width', 'orphans', 'outline-color', 'o
@watzon
watzon / recursion.go
Created June 28, 2016 05:00
Example of a recursive rotation function in Go
package main
import "fmt"
func rotate(index int, args []int) []int {
if len(args) == 0 {
return []int{}
}
@watzon
watzon / packages.el
Created December 30, 2015 15:25
Spacemacs Stylus-Mode
;;; packages.el --- stylus Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
declare module jsforce {
/***********************
* GENERICS
***********************/
type Buffer = any;
type Stream = any;
/***********************