Skip to content

Instantly share code, notes, and snippets.

@ariellephan
ariellephan / scssbestpractice.scss
Last active September 28, 2016 18:06
SCSS best practice
%button {
// … button styles
+ %button {
margin-left: 1rem;
}
}
%modal {
// … modal styles
@ariellephan
ariellephan / regex.js
Last active October 20, 2016 19:53
Useful js regex
//Search for a function
let r = /\((.*)\).*\{([\s\S]*)\}/m
function sayHello(msg) {
console.log(msg);
}
r.exec(sayHello.toString());
@ariellephan
ariellephan / curry.js
Created November 4, 2016 01:22
Currying - functional js
var curryIt = function(uncurried) {
var parameters = Array.prototype.slice.call(arguments, 1);
return function() {
return uncurried.apply(this, parameters.concat(
Array.prototype.slice.call(arguments, 0)
));
};
};
@ariellephan
ariellephan / udacityframeworks.js
Created November 17, 2016 02:33
Udacity frameworks course notes
var numLetters = function(letter) {
return new Function("num", "return ('" + letter + "').repeat(num)");
}
@ariellephan
ariellephan / keymap.cson
Created February 7, 2017 00:30
Enable emmets in handlebars, react for Atom
'atom-text-editor[data-grammar~="jsx"]:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
'atom-text-editor[data-grammar="text html mustache"]:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
'atom-text-editor[data-grammar="text html handlebars"]:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
@ariellephan
ariellephan / handlebarsHelpers.js
Created February 22, 2017 00:58
Handlebars Helpers
Handlebars.registerHelper('compare', function (lvalue, operator, rvalue, options) {
var operators, result;
if (arguments.length < 3) {
throw new Error("Handlerbars Helper 'compare' needs 2 parameters");
}
if (options === undefined) {
options = rvalue;
//Optional Default params
//es6
function myFunc({name = 'Default user', age = 'N/A'} = {}) {
}
//es5 via babeljs.io
'use strict';
function myFunc() {
@ariellephan
ariellephan / modern-js-patterns
Last active August 28, 2017 22:40
JavaScript Patterns in Redux, Vue, etc
//Factory and Decorator
https://medium.com/@tomchentw/redux-universal-576fb9475b5b
https://github.com/redux-saga/redux-saga
https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841
//Singleton
https://medium.com/@cymen/redux-and-the-store-dd9de854d5be
//Command
https://medium.com/front-end-developers/the-command-pattern-c51292e22ea7
@ariellephan
ariellephan / README.md
Created July 5, 2018 05:02 — forked from kerryboyko/README.md
VueJS Best Practices Guide

Deverus Vue.js Style Guide

Guide for developing Vue.js applications.

v. 0.0.1

Vue.js is an amazing framework, which can be as powerful as Angular or React, the two big heavy hitters in the world of front-end frameworks.

However, most of Vue's ease-of-use is due to the use of Observables - a pattern that triggers re-renders and other function calls with the reassignment of a variable.

@ariellephan
ariellephan / README.md
Created July 5, 2018 05:02 — forked from kerryboyko/README.md
VueJS Best Practices Guide

Deverus Vue.js Style Guide

Guide for developing Vue.js applications.

v. 0.0.1

Vue.js is an amazing framework, which can be as powerful as Angular or React, the two big heavy hitters in the world of front-end frameworks.

However, most of Vue's ease-of-use is due to the use of Observables - a pattern that triggers re-renders and other function calls with the reassignment of a variable.