Skip to content

Instantly share code, notes, and snippets.

View listochkin's full-sized avatar

Андрей Листочкин (Andrei Listochkin) listochkin

View GitHub Profile
@terion-name
terion-name / FilterableRouteMixin.coffee
Last active August 29, 2015 14:01
Ember REST pagination and filtering
###
To make a route filterable
specify @modelName property in your route as in example below
App.UsersIndexRoute = Ember.Route.extend Ember.FilterableRouteMixin,
modelName: 'user'
###
Ember.FilterableRouteMixin = Ember.Mixin.create
@steveklabnik
steveklabnik / rust.md
Created June 8, 2014 02:03
Rust changes through versions

Originally taken from here, cached as a gist so I can find it later. "Angolmois" is a music video game, that plays real BeatMania files, so it's a pretty full-featured game. At least, as full as you're gonna find in Rust from as long ago as it was started.

Angolmois Rust edition went through six different Rust releases without almost no change on the features, and the changes are as follows:

Ember.Handlebars.registerHelper('eachIndexed', function eachHelper(path, options) {
var keywordName = 'item',
fn;
// Process arguments (either #earchIndexed bar, or #earchIndexed foo in bar)
if (arguments.length === 4) {
Ember.assert('If you pass more than one argument to the eachIndexed helper, it must be in the form #eachIndexed foo in bar', arguments[1] === 'in');
Ember.assert(arguments[0] + ' is a reserved word in #eachIndexed', $.inArray(arguments[0], ['index', 'index+1', 'even', 'odd']));
keywordName = arguments[0];
rustc points.rs --crate-type=dylib
npm install
node test.js
// A "memory leak" means that, even after garbage collection, memory is still
// not released to the system. Note that this is different from "using a lot
// of memory".
//
// It's of course possible to do things that prevent garbage collection, which
// is a memory leak in JavaScript. (As opposed to a memory leak in the
// JavaScript implementation.)
//
// Even if you do not leak memory, and the implementation does not leak memory,
// if you never hit V8's GC heuristic case, then you might keep *using* a lot
@kmcallister
kmcallister / gist:c9ae9b977a7718376c7f
Last active August 29, 2015 14:12
Macros migration

With Rust 1.0-alpha, the macro reform RFC is mostly implemented. This document gives a quick guide to migrating your code.

Macro syntax

#[macro_use] extern crate

A macro import such as

@beshkenadze
beshkenadze / errors_monitoring_service.md
Last active August 29, 2015 14:23
Compare the services to collect errors.
import Ember from 'ember';
import StartExamMixin from '../../../mixins/start-exam';
import { module, test } from 'qunit';
import sinon from 'sinon';
const {
RSVP,
ActionHandler
} = Ember;
<?php header('HTTP/1.0 500 Internal Server Error'); exit; ?>
@jimmycuadra
jimmycuadra / wat_do.coffee
Created September 14, 2011 04:39
Syntax question for CoffeeScript
# Given a function that accepts a function followed by a non-function argument...
foo = (callback, name) ->
console.log "Calling callback #{name}..."
callback()
# you end up with a line starting with
# a comma which just feels wrong...
foo ->
console.log "Callback called!"
, "bar"