Skip to content

Instantly share code, notes, and snippets.

View artisin's full-sized avatar

te artisin

View GitHub Profile
@artisin
artisin / package.json
Created September 26, 2016 03:28
Example / template for package.json
{
"name": "module-name",
"version": "0.0.1",
"description": "An example module to illustrate the usage of a package.json",
"author": "Your Name <you.name@example.org>",
"license": "MIT",
"contributors": [{
"name": "Foo Bar",
"email": "foo.bar@example.com"
}],

Keybase proof

I hereby claim:

  • I am artisin on github.
  • I am artisin (https://keybase.io/artisin) on keybase.
  • I have a public key whose fingerprint is F120 4AB0 1E07 4C0B 470C 631B 84EC DBCA 1509 0620

To claim this, I am signing this object:

<snippet>
<content><![CDATA[
<div class="codemirror-fixture" data-example="${1:name}"></div>]]></content>
<tabTrigger>-fx</tabTrigger>
<scope>text.html.markdown.multimarkdown, text.html.markdown</scope>
<description>data-example</description>
</snippet>
<snippet>
@artisin
artisin / lost.styl
Created June 21, 2016 18:12
Lost-Stylus-Mod
// Lost Grid v5.1.6 - https://github.com/corysimmons/lost
$gutter = 30px
$rtl = false
$flexbox = true
/**
* Sets a translucent background color to all elements it affects. Helpful while setting up, or debugging, the structure of your site to make sure all items are cleared correctly.
*
@artisin
artisin / kolme-closures.md
Created May 1, 2016 01:43
kolme response

Function: a bunch of code you can call. It can take any number of parameters, and it can have a name.

Closure: The context, or variables and their values around the function when it was defined.

Generator: a special function that can yield more than one result when called in a loop. Generator functions also have closures.

So to shortly answer to your question: functions can't do anything a generator cannot do; or, generators can do more. And they all have closures.

Here's a simple example to understand closures:

@artisin
artisin / sublime-keys.md
Created April 10, 2016 23:27
sublime-keys

Shortcut kets

  • Select obj scope ctrl + shift + j
@artisin
artisin / Ramda-Sanctuary-Learning.md
Last active April 9, 2016 19:11
Ramda and Sanctuary Learning
var safeHead = function(xs) {
  return S.ifElse(() => R.isNil(xs[0]), S.Nothing, S.Just, xs[0]);
};

const streetName = S.pipe([R.prop('addresses'), safeHead, R.map(R.prop('street'))]);

streetName({
  addresses: []
});

Js Functional Practice

Filter List

let filter_list = S.pipe([R.curry(S.is), R.filter]);

//num
let filter_number = filter_list(Number);
filter_number([1, 2, 'a', 'b']); // [1, 2]
filter_number([1, 'a', 'b', 0, 15]); // [1, 15]

Ramda Examples

Ramda Sometime Known As
all every
always const, constant
any some
head first, car
reduce foldl
reduceRight foldr