Skip to content

Instantly share code, notes, and snippets.

// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04

Express.js 4 Cheatsheet

Installation

  • $ sudo npm install express: install the latest Express.js locally`
  • $ sudo npm install express@4.2.0 --save: install Express.js v4.2.0 locally and save to package.json
  • $ sudo npm install -g express-generator@4.0.0: install Express.js command-line generator v4.0.0
@wle8300
wle8300 / loopback-2.18.0-documentation-menu.html
Created May 24, 2015 18:05
Better markup for the Loopback (v2.18.0) docs website at: http://apidocs.strongloop.com/loopback
<ul>
<li>
<a href="#">Loopback</a>
<ul>
<li class="lb-class">
<a href="#var-app-loopback">Class: LoopBackApplication</a>
<ul class="lb-method-type">
<li>
Static Methods
<ul>

NOTE TO THE WARY: "Design One Smart Component At-A-Time!"

Don't try to be (too) innovative. Think in terms of HTML elements like <div>, <p>, <span>, <option>, <input>, <button>, etc. React calls these "native components" -- treat em that way!

⁃	no knowledge outside of itself other than its props. or appstore... but that's it!
⁃	React components represent UI at any POINT-IN-TIME through merely utilizing props and state
⁃	use propTypes brah (and optional: getDefaultProps)
⁃	always be explicit when passing props. none of the crap with spread operators

Phase One: The Non-interactive Version

@wle8300
wle8300 / dynamic-transition.js
Created October 27, 2015 04:34 — forked from Schniz/dynamic-transition.js
React.js + Dynamic.js transitions
const React = require('react');
const dynamics = require('dynamics.js');
/**
* Using dynamics.js to transition things or just animate
* ------------------------------------------------------
* props:
* - runTo enum("start", "finish) - which way to run.
* - onComplete callback
* - onChange callback
dev-server.js:60 [HMR] Waiting for update signal from WDS...
abstract-xhr.js:132 XHR finished loading: GET "http://localhost:3000/sockjs-node/info?t=1470073637035".
client:22 [WDS] Hot Module Replacement enabled.
client:45 [WDS] Errors while compiling.
client:47 ./~/react-spinkit/css/fade-in.css
Module parse failed: /Users/william/Desktop/welp/node_modules/react-spinkit/css/fade-in.css Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '@' (1:0)
at Parser.pp.raise (/Users/william/Desktop/welp/node_modules/react-scripts/node_modules/acorn/dist/acorn.js:923:13)
at Parser.pp.getTokenFromCode (/Users/william/Desktop/welp/node_modules/react-scripts/node_modules/acorn/dist/acorn.js:2831:8)
@wle8300
wle8300 / fizzbuzz.js
Last active November 9, 2016 21:14
Fizzbuzz for JavaScript
function fizzbuzz (set) {
var set = set ? set : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
var isValidSet = set.map((element) => {if (typeof element !== 'number') {return false} else return true}).indexOf(false) === -1 ? true : false
var gotFizz = (n) => {if (n % 3 === 0) {return true} else return false}
var gotBuzz = (n) => {if (n % 5 === 0) {return true} else return false}
if (!Array.isArray(set)) return new Error('First argument must an array with "Number" elements')
if (!isValidSet) return new Error('The elements of the first argument must all be "Numbers"')
@wle8300
wle8300 / Authenticator.js
Last active July 18, 2019 02:41
This was written 2 years ago when I didn't use ES6 React. I'd be happy to share anything else you see at https://app.pub.center.
// "Authenticator" is the state manager for "Login.js" and "Register.js"
// (see below for the files)
import React from 'react'
import Router from 'react-router-component'
import MUIThemeable from 'material-ui/styles/muiThemeable';
const Link = Router.Link
import H1 from './H1'
import Container from './Container'