Skip to content

Instantly share code, notes, and snippets.

Lewis 6ewis

  • Toronto, Ontario
Block or report user

Report or block 6ewis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
6ewis /
Created May 15, 2019 — forked from ncochard/
The correct way to compile ES6 using babel...

When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:

  1. Is it going to be used as a dependency to a nodejs application that is not bundled? (e.g. command line utilities)
  2. Is it going to be used as a dependency to a nodejs application that is bundled? (e.g. AWS Lambdas)
  3. Is it going to be used as a dependency to a browser application (always bundled)?.
  • In cases 2) and 3) you want to allow for tree shaking.
  • In cases 1) and 2) you want to benefit from the "ES6"/"ES next" features supported natively by nodejs.
  • In case 3) you also want to benefit from the native support of "ES6" from your browser.
View ramda-title-case.js
import R from 'ramda';
const capitalize =
6ewis / aws
Created Nov 21, 2018
s3 lambda permission
View aws
"Action": [
"Effect": "Allow",
"Resource": [
6ewis / example.txt
Last active Jan 13, 2018
using reduce for updating nested object vs destructuring
6ewis / Life cycle method
Created Oct 13, 2017
Describe the life-cycle method
View Life cycle method
* ------------------ The Life-Cycle of a Composite Component ------------------
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount
View sorting-sort.clj
(defn remove-one [item list]
(let [[n m] (split-with (partial not= item) list)] (vec (concat n (rest m)))))
(defn sorting-sort [unsorted]
(loop [inner-unsorted unsorted sorted []]
(let [min-val (apply min inner-unsorted)]
(= 1 (count inner-unsorted))
(empty? inner-unsorted))
6ewis / mock_monster.rb
Created Jun 17, 2016 — forked from havenwood/mock_monster.rb
Mocking a few Monsters with Minitest::Mock
View mock_monster.rb
require 'minitest/mock'
# This monster eats Symbols. Give it a Symbol and how many to eat and nom nom!
monster =
monster.expect :eat, :nom_nom, [Symbol, Numeric]
# Let's verify the monster in fact ate its Symbols:
View curryAandFilter.js
const data = [
"client_number": "00001",
"client_name": "voila Communications Ltd.",
"address1": "Ben votrant",
"address2": "voila Communications",
"address3": "P.O. Box 2086",
"address4": "55 Victoria Street",
"address5": "toronto",
"address6": "BERMUDA"
6ewis / recursion-contains-key.clj
Last active Apr 7, 2016
(contains-key :a {:v 1 :b 3 :a 3 :g 6})
View recursion-contains-key.clj
(boolean (seq (filter #(= k (key %)) m)))
(defn contains-key [m k]
(loop [[entry & rest :as coll] (seq m)]
(if (empty? coll)
(or (= (first entry) k)
(recur rest)))))
View versionWork2.js
const Test = React.createClass({
render: function() {
return (
getInitialState: function() {
return {term: "test"};
handleChange: function(event) {
You can’t perform that action at this time.