Skip to content

Instantly share code, notes, and snippets.

View listochkin's full-sized avatar

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

View GitHub Profile

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@bcantrill
bcantrill / dtrace-on-rust
Last active May 29, 2023 07:37
DTrace on Rust. This shows running dtrace(1M) on a simple Rust program. Rust is running in a 64-bit LX-branded zone on SmartOS, an illumos derivative. Running stock (alpha) Rust and latest SmartOS.
root@1eec2cd3-2cba-e416-e1b6-845b715b736c:~# uname -a
Linux 1eec2cd3-2cba-e416-e1b6-845b715b736c 3.13.0 BrandZ virtual linux x86_64 x86_64 x86_64 GNU/Linux
root@1eec2cd3-2cba-e416-e1b6-845b715b736c:~# rustc -Vv
rustc 1.0.0-nightly (44a287e6e 2015-01-08 17:03:40 -0800)
binary: rustc
commit-hash: 44a287e6eb22ec3c2a687fc156813577464017f7
commit-date: 2015-01-08 17:03:40 -0800
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
root@1eec2cd3-2cba-e416-e1b6-845b715b736c:~# cat hello.rs
@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

// 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
@StephanHoyer
StephanHoyer / gist:bddccd9e159828867d2a
Last active March 29, 2022 11:46
Isomorphic applications with mithril

Attention

This post described how to create an application with mithril 0.2.x. Now that ver 1.0 is out, some things are a little differnent.

The example is updated with the current version of mithril, though.

Isomorphic applications with mithril

A small sampling of external projects initially built for Ember use but designed to be used standalone:

rustc points.rs --crate-type=dylib
npm install
node test.js
@terion-name
terion-name / Video Loader.md
Last active March 3, 2022 03:02
HTML5 Video force preloader
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];