This code is modified from the excellent O'Reilly book "Functional JavaScript". You should buy it, I highly recommend it! Don't kid yourself into thinking this gist even remotely covers the great content from a 200+ page technical book on the subject; it doesn't. Buy the book and get the in-depth knowledge for yourself. It's worth it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Read a command from the minibuffer fuzzily | |
*/ | |
minibuffer.prototype.read_command_fuzzy = function () { | |
keywords( | |
arguments, | |
$prompt = "Command", $history = "command", | |
$completer = all_word_completer ( | |
$completions = function (visitor) { | |
for (let [k,v] in Iterator(interactive_commands)) { |
This is a reference to Matthew Ericson's article Export Illustrator Layers and/or Artboards as PNGs and PDFs in case something happens to happen to the article, and if I just forget where to find the exporter online.
- Drop
MultiExporter.js
into/Applications/Adobe\ Illustrator\ CS6/Presets.localized/en_GB/Scripts
- Restart Illustrator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Export Layers as PNG files with original layer structure | |
var options = new ExportOptionsPNG24(); | |
var doc = app.activeDocument; | |
$.writeln("trying to save"); | |
var newdoc = app.documents.add(doc.documentColorSpace, doc.width, doc.height); | |
newdoc.artboards[0].artboardRect = doc.artboards[0].artboardRect; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Prevent the cursor from blinking | |
(blink-cursor-mode 0) | |
;; Don't use messages that you don't read | |
(setq initial-scratch-message "") | |
(setq inhibit-startup-message t) | |
;; Don't let Emacs hurt your ears | |
(setq visible-bell t) | |
;; You need to set `inhibit-startup-echo-area-message' from the | |
;; customization interface: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require("assert"), | |
_ = require("underscore"), | |
testData = { | |
"Iron Man": ["Robert Downey Jr", "Gwyneth Paltrow", "Terrence Howard"], | |
"Iron Man 3": ["Robert Downey Jr", "Guy Pearce", "Gwyneth Paltrow"], | |
"Super Troopers": ["Jay Chandrasekhar", "Kevin Heffernan"], | |
"The Day After Tomorrow": ["Dennis Quaid", "Jake Gyllenhaal", "Emmy Rossum"], | |
"The Phantom of the Opera": ["Gerard Butler", "Emmy Rossum", "Patrick Wilson"], | |
"How I Met Your Mother": ['Josh Radnor', "Jason Segel", "Cobie Smulders", "Kevin Heffernan"], | |
"Despicable Me": ['Steve Carell', 'Jason Segel', 'Russel Brand', "Michael Fassbender"], |
IE9, IE10, and IE11 don't properly scale SVG files added with img
tags when viewBox
, width
and height
attributes are specified. View this codepen on the different browsers.
Image heights will not scale when the images are inside containers narrower than image widths. This can be resolved in 2 ways.
As per this answer on Stackoverflow, the issue can be resolved by removing just the width
and height
attributes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MultiExporter.jsx | |
// Version 0.1 | |
// Version 0.2 Adds PNG and EPS exports | |
// Version 0.3 Adds support for exporting at different resolutions | |
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize | |
// Version 0.5 Fixed cropping issues | |
// Version 0.6 Added inner padding mode to prevent circular bounds clipping | |
// | |
// Copyright 2013 Tom Byrne | |
// Comments or suggestions to tom@tbyrne.org |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var app = angular.module("myApp", ['ngRoute']); | |
app.config(['$routeProvider', function($routeProvider) { | |
$routeProvider.when('/', { | |
templateUrl: 'partials/home.html', | |
controller: 'HomeCtrl' | |
}); | |
$routeProvider.when('/services', { |