Skip to content

Instantly share code, notes, and snippets.

#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
use jsonwebtoken::{decode, encode, Algorithm, DecodingKey, EncodingKey, Header, Validation};
use rocket::request::{self, FromRequest, Request};
use rocket::Outcome;
use serde::{Deserialize, Serialize};
@bionicbrian
bionicbrian / crazy-functional-things.md
Created December 12, 2016 15:00
Crazy Functional JS Things

This is a draft of stuff related to the weird and wonderful world of modern functional JavaScript, and will probably change over time.

This might serve as an entry point for anyone interested in exploring functional programming in JS who is just starting out. And I have a lot to learn, so I would love to geek out with anyone else who's interested in this stuff too.

Functional JavaScript, the Book

There is a great book appropriately named Functional JavaScript that dives into functional concepts using underscore. It goes a long way with just functions (no weird things like monads or types). This is a great place for people to get started with functional programming in JavaScript.

Ramda

@bionicbrian
bionicbrian / component-name.scss
Last active August 29, 2015 14:26
Module SCSS
.y-thingy {
$root: &; // Store it for later use...
background-color: pink;
border: 1px solid purple;
&__content {
margin: {
top: 5px;
bottom: 10px;
@bionicbrian
bionicbrian / gist:75d3854c00f188138e3a
Last active August 29, 2015 14:25
Mixin Behaviors with React Lifecycle Hooks
var mixinBehavior = (behavior) => (target) => {
var componentDidMount = target.prototype.componentDidMount;
target.prototype.componentDidMount = function () {
componentDidMount.call(this);
behavior.onComponentDidMount(this);
}
}
class DraggableBehavior {
constructor(config) {
@bionicbrian
bionicbrian / index.js
Last active August 29, 2015 14:08
requirebin sketch
var _ = require("underscore");
var Backbone = require("backbone");
function createElement(content) {
var el = document.createElement("div");
document.body.appendChild(el);
el.innerHTML = content;
}
var target = {};
target.show = function () {
[].slice.call(arguments).forEach(function (arg) {
console.log(arg);
});
};
target.wrap = function(name, wrapper) {
var context = Object.create(target);
@bionicbrian
bionicbrian / brianjamesmoore
Created November 5, 2012 14:38
Brian Moore Description
GET /hireme HTTP/1.0
{
"name": "Brian Moore",
"location": "Brooklyn, NY",
"passion": "JavaScript",
"availableForHire": true
}
@bionicbrian
bionicbrian / listview.coffee
Created December 14, 2011 22:22
ListView Coffee
class ListView extends Backbone.View
el: $('#myList')
events:
'keypress #myInputForm': 'addWithReturn'
initialize: ->
@collection = window.Items
@collection.bind('add', @appendItem)