This tutorial assumes a reasonably new version of Emacs (24.4+)
Erlang Development Tool Suite aims to provide common IDE like functionality.
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
// List all files in a directory in Node.js recursively in a synchronous fashion | |
var walkSync = function(dir, filelist) { | |
var fs = fs || require('fs'), | |
files = fs.readdirSync(dir); | |
filelist = filelist || []; | |
files.forEach(function(file) { | |
if (fs.statSync(dir + file).isDirectory()) { | |
filelist = walkSync(dir + file + '/', filelist); | |
} | |
else { |
// XML NULL FIELD REMOVAL | |
// Removes all Null fields (both with nil=true) from a XmlDoc | |
public static XmlDocument RemoveNullFields(this XmlDocument xmldoc) | |
{ | |
XmlNamespaceManager mgr = new XmlNamespaceManager(xmldoc.NameTable); | |
mgr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); | |
XmlNodeList nullFields = xmldoc.SelectNodes("//*[@xsi:nil='true']", mgr); |
// XPath CheatSheet | |
// To test XPath in your Chrome Debugger: $x('/html/body') | |
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/ | |
// 0. XPath Examples. | |
// More: http://xpath.alephzarro.com/content/cheatsheet.html | |
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>D3 Drawing</title> | |
<script src="https://cdn.jsdelivr.net/d3js/3.5.9/d3.min.js"></script> | |
</head> | |
<body> | |
<h3>Draw a polygon :D</h3> | |
<script> |
This tutorial assumes a reasonably new version of Emacs (24.4+)
Erlang Development Tool Suite aims to provide common IDE like functionality.
// take SVG commands and draw this path to HTML5 canvas | |
// commandList should look like that: [ { marker: "M", values: [ 10, 10 ] }, | |
// { marker: "l", values: [ 5, 7 ] }, | |
// { marker: "C", values: [ -5, 7.2, .3, -16, 24, 10 ] }, | |
// . . . | |
// { marker: "z", values: [ ] } ] | |
// there's another gist which has the code to parse SVG paths: | |
// https://gist.github.com/shamansir/0ba30dc262d54d04cd7f79e03b281505 |
Given an Array of Functions fns
, what argument(s) can you pass to fns.forEach
such that each function in fns
will execute, in order, without creating any anonymous (or named) functions or invoking the Function
constructor?
function
keyword, or arrow functions () =>
.Function
constructor.Function#bind
& friends on the Function.prototype
are ok./** | |
* ScrollTo utility | |
* © https://gist.github.com/james2doyle/5694700 | |
*/ | |
const easeInOutQuad = (t, b, c, d) => { | |
if ((t /= d / 2 ) < 1) return c / 2 * t * t + b; | |
return -c / 2 * ((--t) * (t - 2) - 1) + b; | |
}; |