Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');| /*<?php | |
| //*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s", | |
| //\u000A\u002F\u002A | |
| class PhpJava { | |
| static function main() { | |
| echo(//\u000A\u002A\u002F | |
| "Hello World!"); | |
| }} | |
| //\u000A\u002F\u002A | |
| PhpJava::main(); |
Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.
The Atom documentation is excellent. It's highly worth reading the flight manual.
| function mapValues(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| result[key] = fn(obj[key], key); | |
| return result; | |
| }, {}); | |
| } | |
| function pick(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| if (fn(obj[key])) { |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent| var gulp = require('gulp') | |
| var browserify = require('browserify') | |
| var watchify = require('watchify') | |
| var babelify = require('babelify') | |
| var source = require('vinyl-source-stream') | |
| var buffer = require('vinyl-buffer') | |
| var merge = require('utils-merge') |
| #!/usr/bin/env bash | |
| # | |
| # An example init script for running a Node.js process as a service | |
| # using Strongloop's slc as the process monitor. For more configuration options | |
| # associated with slc, see: http://docs.strongloop.com/display/public/SLC/slc+run. | |
| # This script assumes you've installed slc globally with `npm install -g strongloop`. | |
| # | |
| # You will need to set the environment variables noted below to conform to | |
| # your use case, and change the init info comment block. | |
| # |
| Afghanistan | |
| Albania | |
| Algeria | |
| Andorra | |
| Angola | |
| Antigua & Deps | |
| Argentina | |
| Armenia | |
| Australia | |
| Austria |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');Those suck for maintenance and they're ugly.
| # Tab completion for scp/sftp/ssh based on ~/.ssh/config | |
| complete -o default -o nospace -W "$(/usr/bin/ruby -ne 'puts $_.split(/[\s,]+/)[1..-1].reject { |h| h.match /\*|\?/ } if $_.match /^\s*Host[s]*\s+/' < ~/.ssh/config)" scp sftp ssh 2>/dev/null |