In functional programming you often want to apply a function partly. A simple example is a function add.
It would be nice if we could use add like:
var res2 = add(1, 3); // => 4
var add10To = add(10);
var res = add10To(5); // => 15
| /* http://meyerweb.com/eric/tools/css/reset/ | |
| v2.0 | 20110126 | |
| License: none (public domain) */ | |
| html, body, div, span, applet, object, iframe, | |
| h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
| a, abbr, acronym, address, big, cite, code, | |
| del, dfn, em, img, ins, kbd, q, s, samp, | |
| small, strike, strong, sub, sup, tt, var, | |
| b, u, i, center, |
| /* | |
| * This work is free. You can redistribute it and/or modify it under the | |
| * terms of the Do What The Fuck You Want To Public License, Version 2, | |
| * as published by Sam Hocevar. See the COPYING file for more details. | |
| */ | |
| /* | |
| * Easing Functions - inspired from http://gizma.com/easing/ | |
| * only considering the t value for the range [0, 1] => [0, 1] | |
| */ | |
| EasingFunctions = { |
| <?xml version="1.0"?> | |
| <root> | |
| <appdef> | |
| <appname>Terminal</appname> | |
| <equal>com.apple.Terminal</equal> | |
| </appdef> | |
| <item> | |
| <name>TMUX Key Remappings</name> | |
| <item> | |
| <name>TMUX: Right Control to Ctrl+B</name> |
| // WebKit font-smoothing | |
| //------------------------------------------------ | |
| // References: | |
| // | |
| // 1. http://maxvoltar.com/sandbox/fontsmoothing/ | |
| // 2. http://maxvoltar.com/archive/-webkit-font-smoothing | |
| // | |
| // Values: none, antialiased (default), subpixel-antialiased | |
| // |
| /** | |
| * Include Roboto Condensed font in your project | |
| * | |
| * Download Roboto Condensed ttf files from Google Fonts and place it in the same directory of this CSS file | |
| * You can then use this font in your project by setting | |
| * font-face: "Roboto Condensed", Helvetica, Arial, sans-serif; | |
| * | |
| * @author Mattia Migliorini (deshack) | |
| * @license MIT | |
| */ |
| # first: | |
| lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
| sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
| # To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
| # go to /usr/local/lib and delete any node and node_modules | |
| cd /usr/local/lib | |
| sudo rm -rf node* |
| /** | |
| * version1: convert online image | |
| * @param {String} url | |
| * @param {Function} callback | |
| * @param {String} [outputFormat='image/png'] | |
| * @author HaNdTriX | |
| * @example | |
| convertImgToBase64('http://goo.gl/AOxHAL', function(base64Img){ | |
| console.log('IMAGE:',base64Img); | |
| }) |
| #!/bin/env fish | |
| function cd -d "change directory, and activate virtualenvs, if available" | |
| # first and foremost, change directory | |
| builtin cd $argv | |
| # find a parent git directory | |
| if git rev-parse --show-toplevel >/dev/null ^/dev/null | |
| set gitdir (realpath (git rev-parse --show-toplevel)) | |
| else |
| /* | |
| * Simple Publish / subscribe events routine. | |
| * | |
| * Used to extend an object with the subscribe and publish methods. | |
| * The return value of subscribe has a remove method that can be used | |
| * to unsubscribe. | |
| * | |
| * Modifies the object directly. | |
| */ | |
| var $$ = $$ || {}; //This is the utility functions object used elsewhere. |