Skip to content

Instantly share code, notes, and snippets.

Alex Matchneer machty

Block or report user

Report or block machty

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@machty
machty / index.html.slim
Created Apr 7, 2012
An attempt at Slim/Haml helpers for handlebars
View index.html.slim
= handlebars_template_named "edit-field" do
= hb %{ if isEditing } do
= hb %{ view BD.TextField valueBinding="value" }
= hb_else
= hb %{ if value } do
= hbb %{ value }
= hb_else
span.no-name empty
/ Outputs
@machty
machty / gist:2931511
Created Jun 14, 2012
async queue download
View gist:2931511
ownloadQueue = async.queue (photo, callback) ->
# Here we define the task handled by this concurrency-limiting queue.
downloadfile = photo.url
host = url.parse(downloadfile).hostname
filename = url.parse(downloadfile).pathname.split("/").pop()
filename = "./public/downloads/#{filename}"
photo.localFilename = filename
console.log "set photo.localFilename to #{photo.localFilename}"
theurl = http.createClient(80, host)
requestUrl = downloadfile
View gist:2931630
DOWNLOAD_CONCURRENCY = 10
# Data Structures
longPollRequests = []
jobs = {}
downloadQueue = async.queue (photo, callback) ->
# Here we define the task handled by this concurrency-limiting queue.
downloadfile = photo.url
host = url.parse(downloadfile).hostname
filename = url.parse(downloadfile).pathname.split("/").pop()
@machty
machty / Assetfile
Last active Dec 10, 2015
Rake Pipeline filter for syncing already-published static content on production with the generated local file via Nokogiri and css selectors
View Assetfile
require "rake-pipeline-web-filters"
require "./remote-replace-filter"
# specify output, other configuration
input "app" do
match "slim/whatever.slim" do
tilt { |input| input.sub(/\.slim$/, '.html') }
copy "index.html"
@machty
machty / emblem
Last active Dec 10, 2015
Emblem/Emblate: indentation-based templating language targeting Ember Handlebars
View emblem
Emblem examples:
1) Text / property lookup / helpers
#bar.baz Raw text
#bar.baz
| Raw text
on multiple lines
with {{normal}} Handlebars syntax support
as well as raw <span>HTML</span> support.
@machty
machty / newoperator.coffee
Created Jan 9, 2013
Proposal: add block level lambda ~> operator to CoffeeScript to hackishly achieve block level lambda functionality in pre ES6 Javascript. An example of block level lambdas is returning a value from within a .each loop in Ruby. See below.
View newoperator.coffee
findTheThingWeWant = (things) ->
things.each (thing) ~>
return item if thing.isWhatWeWant
View gist:4518165
// Version: v1.0.0-pre.2-318-g075ed98
// Last commit: 075ed98 (2013-01-07 10:58:00 -0800)
(function() {
/*global __fail__*/
/**
Ember Debug
View withdraw_controller.js.coffee
State = (hash) -> Em.State.extend hash
TransitionTo = Em.State.transitionTo
C = null
Receivers.WithdrawController = Em.ObjectController.extend
receiverController: null
router: null
init: ->
@_super()
View pegjs for emblem
start = content
content = statement*
statement
= html
/ mustache
html
= htmlMaybeBlock
View emblem.js
this.StringScanner = (function() {
var StringScanner;
StringScanner = (function() {
function StringScanner(str) {
this.str = str != null ? str : '';
this.str = '' + this.str;
this.pos = 0;
this.lastMatch = {
reset: function() {
You can’t perform that action at this time.