(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
/* | |
If you are attempting to call an AJAX API, via GET which responds: | |
No 'Access-Control-Allow-Origin' header is present on the requested resource. | |
You can modify the way you query it to go through a server which will add the header. | |
Basically, you add the URL you want (with query string parameters) at the end of | |
'https://cors-anywhere.herokuapp.com/' | |
, and ensure that your ajax call is done with some additional options as shown below | |
See CORS-Anywhere documentation here for more: |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
COMPILED_COFFEE = ' < -' | |
PLAIN_JS = '<-' | |
thenify = (lines) -> | |
[line, rest...] = lines | |
if rest.length is 0 | |
line | |
else if line.search(PLAIN_JS) > 0 or line.search(COMPILED_COFFEE) > 0 | |
[value, promise] = line.split if line.search(PLAIN_JS) > 0 then PLAIN_JS else COMPILED_COFFEE | |
noSemiColon = promise.slice(0, -1) |
This is a plain-text version of Bret Victor’s reading list. It was requested by hf on Hacker News.
Highly recommended things!
This is my five-star list. These are my favorite things in all the world.
A few of these works have had an extraordinary effect on my life or way of thinking. They get a sixth star. ★
here's how i think of branching.
you need to write some code. since you may end up writing good code, but there's a chance you'll write bad code, branches allow you to freely commit your changes as you go along without affecting the core of the project. if you end up with something you don't like, you can clip the branch like nothing ever happened.
i think branches fall into a few categories.
def shannon_entropy(img): | |
# calculate the shannon entropy for an image | |
histogram = img.histogram() | |
histogram_length = sum(histogram) | |
samples_probability = [float(h) / histogram_length for h in histogram] | |
return -sum([p * math.log(p, 2) for p in samples_probability if p != 0]) |
######################### | |
# .gitignore file for Xcode4 and Xcode5 Source projects | |
# | |
# Apple bugs, waiting for Apple to fix/respond: | |
# | |
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation? | |
# | |
# Version 2.6 | |
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
# |
# sample shortcuts | |
{ "keys": ["ctrl+super+]"], "command": "snap_lines_to_indent_level", "args": { "snap_direction": 1 } }, | |
{ "keys": ["ctrl+super+["], "command": "snap_lines_to_indent_level", "args": { "snap_direction": -1 } } |
I spent a lot of time trying to find a pretty optimal (for me) setup for Clojure… at the same time I was trying to dive in and learn it. This is never optimal; you shouldn't be fighting the environment while trying to learn something.
I feel like I went through a lot of pain searching Google, StackOverflow, blogs, and other sites for random tidbits of information and instructions.
This is a comprehensive "what I learned and what I ended up doing" that will hopefully be of use to others and act as a journal for myself if I ever have to do it again. I want to be very step-by-step and explain what's happening (and why) at each step.
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications
like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html