# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
This file contains 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
<html> | |
<head> | |
<!-- adapted from http://charlesleifer.com/blog/using-python-and-k-means-to-find-the-dominant-colors-in-images/ --> | |
<script type="text/javascript"> | |
function euclidean(p1, p2) { | |
var s = 0; | |
for (var i = 0, l = p1.length; i < l; i++) { | |
s += Math.pow(p1[i] - p2[i], 2) | |
} |
This file contains 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
function getAverageColourAsRGB (img) { | |
var canvas = document.createElement('canvas'), | |
context = canvas.getContext && canvas.getContext('2d'), | |
rgb = {r:102,g:102,b:102}, // Set a base colour as a fallback for non-compliant browsers | |
pixelInterval = 5, // Rather than inspect every single pixel in the image inspect every 5th pixel | |
count = 0, | |
i = -4, | |
data, length; | |
// return the base colour for non-compliant browsers |
By the way, I'm available for tutoring and code review :)
- What Promises library should I use?
- How do I create a Promise myself?
- How do I use
new Promise
? - How do I resolve a Promise?
- But what if I want to resolve a synchronous result or error?
- [But what if it's at the start of a chain, and I'm not in a
.then
callback yet?](https://gist.github.com/joepie91/4c3a10629a4263a522e3bc4839a28c83#6-but
This file contains 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
Template.example.events({ | |
'change input': function(ev) { | |
_.each(ev.srcElement.files, function(file) { | |
Meteor.saveFile(file, file.name); | |
}); | |
} | |
}); |
This file contains 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
/* | |
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes. | |
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed | |
* | |
* Usage: | |
* $ casperjs screenshots.js http://example.com | |
*/ | |
var casper = require("casper").create(); |
This file contains 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
/* ========================================================================== | |
Grid Overlay Styles | |
Author: Steve Hickey | http://stevehickeydesign.com | |
Company: Fresh Tilled Soil | http://freshtilledsoil.com | |
========================================================================== */ | |
div#gridOverlay { | |
position: absolute; | |
top: 0; right: 0; bottom: 0; left: 0; | |
width: 940px; | |
margin: 0 auto; |
This file contains 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
#!/usr/bin/env python | |
# Copyright 2013 Evernote Corporation. All rights reserved. | |
import base64 | |
import sys | |
# Copy the base64 string from the ENEX file and put it into a file | |
# Pipe base64-encoded data to STDIN |
This file contains 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
# Create a new self signed HTTPS Certificate for IIS Express | |
# Crafted with all organic, GMO, gluten free ingreditations | |
# with an artisinal SAN to make Chrome 58 onwards happy. | |
# | |
# See https://bugs.chromium.org/p/chromium/issues/detail?id=308330 | |
# | |
# Run this at an administrative PowerShell prompt. | |
# | |
# You will be prompted to trust a new certificate via a windows dialog. | |
# Click yes otherwise Visual Studio will not be able to determine your |
This file contains 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
// Import Handlebars runtime lib | |
const Handlebars = require('handlebars/runtime'); | |
const register = require('handlebars-form-helpers').register; | |
const { registerHandlebarHelpers } = require('../../some/other/place'); | |
// Register extra helpers | |
register(Handlebars); | |
registerHandlebarHelpers(Handlebars); |