Skip to content

Instantly share code, notes, and snippets.

View darrylhebbes's full-sized avatar

Darryl Hebbes darrylhebbes

  • Berlin, Germany
View GitHub Profile
/**
* 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)) {
@Integralist
Integralist / 0. JavaScript Function Programming TOC.md
Last active July 3, 2018 04:57
JavaScript Function Programming (scratch pad) -> Most of the code here is modified from the excellent O'Reilly book "Functional JavaScript".

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.

@larrybotha
larrybotha / A.markdown
Last active April 8, 2025 07:31
Export multiple artboards in Adobe Illustrator to png, or pdf

Export multiple Adobe Illustrator artboards to png, jpg, pdf

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.

Usage

  • Drop MultiExporter.js into /Applications/Adobe\ Illustrator\ CS6/Presets.localized/en_GB/Scripts
  • Restart Illustrator
@mikaelbr
mikaelbr / destructuring.js
Last active February 20, 2025 13:00
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@nicloay
nicloay / ai.export.js
Created February 5, 2014 17:59
Export adobe illustrator visible layers to png files with the same layer name structure (layers->sublayers becomes folder->subfolders)
// 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;
@bzg
bzg / emacs-strip.el
Last active January 2, 2023 21:22
Emacs, naked
;; 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:
@marcmartino
marcmartino / baconTree.js
Created December 24, 2013 04:42
Given a large hash table whose keys are movie names and whose values are a list of actors in those movies, write a function to determine the Bacon number of a particular actor.
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"],
@larrybotha
larrybotha / A.markdown
Last active May 1, 2025 17:28
Fix SVGs not scaling in IE9, IE10, and IE11

Fix SVG in <img> tags not scaling in IE9, IE10, IE11

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.

Use sed in bash to remove width and height attributes in SVG files

As per this answer on Stackoverflow, the issue can be resolved by removing just the width and height attributes.

@TomByrne
TomByrne / MultiExporter.jsx
Last active April 2, 2025 10:37
An Illustrator script for exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
// 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
@spacerockzero
spacerockzero / snippet: angular new app template
Created November 22, 2013 17:07
Angular new app template
'use strict';
var app = angular.module("myApp", ['ngRoute']);
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/', {
templateUrl: 'partials/home.html',
controller: 'HomeCtrl'
});
$routeProvider.when('/services', {