Skip to content

Instantly share code, notes, and snippets.

Generating legacy code

Hector Zarco zzarcon

Generating legacy code
View GitHub Profile
kripken / hello_world.c
Last active May 6, 2022
Standalone WebAssembly Example
View hello_world.c
int doubler(int x) {
return 2 * x;
gaearon / connect.js
Last active May 5, 2022
connect.js explained
View connect.js
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
View on-jsx.markdown

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

mobz / watchify browserlfy babelify
Created Mar 17, 2015
one line build system for browserify babeljs and watch ( watchify / babelify )
View watchify browserlfy babelify
./node_modules/watchify/bin/cmd.js -v -t babelify src -o dist
patrickarlt /
Last active Mar 25, 2020
ES 7 async/await demo!
babel github-es6.js -o github.js --optional runtime --experimental
Turbo87 / app.js
Created Feb 15, 2015
webpack + font-awesome test
View app.js
document.body.innerHTML = '<i class="fa fa-fw fa-question"></i>';
codler / css-supports.js
Last active Jun 28, 2020
CSS.supports() Polyfill
View css-supports.js
/*! CSS.supports() Polyfill
* Copyright (c) 2014 Han Lin Yap; MIT license */
if (!('CSS' in window)) {
window.CSS = {};
if (!('supports' in window.CSS)) {
window.CSS._cacheSupports = {};
window.CSS.supports = function(propertyName, value) {
addyosmani /
Last active May 27, 2022 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

CrocoDillon / cookies.js
Last active Oct 30, 2020
Export your awesome module using AMD, CommonJS, Node.js or just as global.
View cookies.js
* Inspiration (well… copy pasting more or less) from:
* Thanks Scott!
(function (global) {
'use strict';
var MyModule = function () {
plapier / ellipsis.scss
Created Feb 14, 2013
Sass Ellipsis Mixin
View ellipsis.scss
@mixin ellipsis ($max-width){
display: inline-block;
max-width: $max-width;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;