CoffeeScript 1.7 is shaping up to be a pretty kick-ass release with significant improvements. Here are the ones I'm most excited about, in order of my own excitement.
Years of being wished for, finally granted!
var svg = document.querySelector( "svg" ); | |
var svgData = new XMLSerializer().serializeToString( svg ); | |
var canvas = document.createElement( "canvas" ); | |
var ctx = canvas.getContext( "2d" ); | |
var img = document.createElement( "img" ); | |
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) ); | |
img.onload = function() { |
// Writing JS for everything is great and all, but I don't want to see JS | |
// inline in my Jade templates. Thankfully, there are ways of abstrating it | |
// into mixins! | |
// Want some Rails-like helpers? | |
mixin link_to(name, href) | |
- href = href || "#" | |
a(href="#{href}")= name | |
// How about a single editing point for a class name? |
/* | |
* Uses https://github.com/nkostelnik/gulp-s3 with | |
* Gulpjs: http://gulpjs.com/ | |
*/ | |
var s3_creds = { | |
"key": "AKIAI3Z7CUAFHG53DMJA", | |
"secret": "acYxWRu5RRa6CwzQuhdXEfTpbQA+1XQJ7Z1bGTCx", | |
"bucket": "dev.example.com", | |
"region": "eu-west-1" |
block = -> | |
@word32lu("version").tap (vars) -> | |
throw new Error("version="+vars.version) if vars.version isnt 1 | |
@buffer "previous", 32 | |
@buffer "merkle", 32 | |
@word32lu "timestamp" | |
@word32lu "difficulty" | |
@word32lu "nonce" | |
varInt @, "txCount" |
CoffeeScript 1.7 is shaping up to be a pretty kick-ass release with significant improvements. Here are the ones I'm most excited about, in order of my own excitement.
Years of being wished for, finally granted!
/* | |
From https://github.com/gulpjs/gulp/issues/101. Organize gulpfile.js using concept of environment variables. | |
1. Set up sub-tasks to behave in a certain according to env var; may be env agnostic. | |
2. Set up high-level tasks to run a group of sub-tasks to orchestrate a behaviour (testing, staging, prod, etc) | |
*/ | |
var R = 0; | |
var ENV_SWITCH = void 0; |
This is a simple widget that lets you render pie charts in Dashing. Forked from stevenleeg/pie.coffee It looks a little bit like this:
dashboard.erb
:
#!/usr/bin/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |