Skip to content

Instantly share code, notes, and snippets.

View jstnjns's full-sized avatar
🕺

Justin Jones jstnjns

🕺
View GitHub Profile
@jstnjns
jstnjns / machine.js
Created September 17, 2021 21:09
Generated by XState Viz: https://xstate.js.org/viz
const assignData = assign((context, { type, ...data }) => data)
const submissionMachine = Machine({
id: 'submission',
initial: 'upload',
strict: true,
states: {
upload: {
on: {
@jstnjns
jstnjns / machine.js
Last active December 30, 2020 00:39
Generated by XState Viz: https://xstate.js.org/viz
const assignData = assign((context, {type, ...data}) => console.log('assignData', type, data) || data)
const cartMachine = Machine({
id: 'cart',
initial: 'organization',
strict: true,
states: {
organization: {
on: {
@jstnjns
jstnjns / machine.js
Last active September 6, 2019 22:11
Generated by XState Viz: https://xstate.js.org/viz
const experiments = [
'experiment_a',
'experiment_b',
'experiment_c',
]
const experimentStates = () => {
if (experiments.length) {
let states = {}
@jstnjns
jstnjns / grid-square.scss
Created August 3, 2015 20:56
BS Square Grid
//
// Square
//
@mixin make-square-grid($index, $class) {
.col-#{$class}-square.col-#{$class}-#{$index} {
margin-top: -$grid-gutter-width / 2;
margin-bottom: -$grid-gutter-width / 2;
padding-bottom: percentage(($index / $grid-columns));
@jstnjns
jstnjns / mixins-responsive.scss
Created July 9, 2015 22:58
Responsive Mixins
@mixin media-xs {
@media screen and (min-width: $screen-xs-min) and (max-width: $screen-xs-max) {
@content;
}
}
@mixin media-sm {
@media screen and (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
@content;
}
@jstnjns
jstnjns / REST.md
Last active August 20, 2018 20:10
A flexible design for a RESTful API

Request

HTTP Methods

POST

  • Without ID will create a new item in a collection, and return that new item
  • Without ID, with reference_id in payload will create a new item in a collection with the same attributes as the item with a matching id as the reference_id (and use any other attributes in payload as overrides), and return that new item (cloning)
  • With an ID will return error code 405
@jstnjns
jstnjns / backbone.model.reset.js
Created October 26, 2012 01:50
Backbone.Model.reset()
// If you override the initialize, all that is needed to
// incorporate this functionality is to call
// `model.__super__.initialize()` in your subs constructor
Backbone.Model.prototype.initialize = function() {
this._setOriginalAttributes();
return this;
};
//
Backbone.Model.prototype._setOriginalAttributes = function() {
@jstnjns
jstnjns / Default (OSX).sublime-keymap
Created August 7, 2012 21:43
Sublime Text key mapping for CMD + L to be "Go To Line Number:"
[
{
"keys": ["super+l"], // "control+l" on non-Mac
"command": "show_overlay",
"args": {
"overlay": "goto",
"text": ":"
}
}
]
@jstnjns
jstnjns / .gitconfig
Created August 2, 2012 20:18
.gitconfig
[alias]
lg = log --color --graph --pretty=format:'%C(red bold)%h%Creset -%C(yellow reverse bold)%d%Creset %s %C(green bold)(%cr) %C(cyan bold)<%an>%Creset' --abbrev-commit --
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = cyan reverse
local = cyan
remote = yellow bold