Skip to content

Instantly share code, notes, and snippets.

View giuseppeg's full-sized avatar
🌊
All is well.

Giuseppe giuseppeg

🌊
All is well.
View GitHub Profile
// Flight Proposal: Groups
// Its useful to be able to structure components together
// so that we can manage their lifecycles. We currently
// group components together using simple initialization
// functions which give us a rough structure but don't
// allow us to manage lifecycles easily which has given
// rise to nested components. However, it's not desirable
// to couple one component to another in this way and
// departs from the self contained nature of Flight
@lourenzo
lourenzo / sublime_revert_open_files.py
Last active December 29, 2015 03:19
Revert all open files on the current window from Sublime Text Console - Works with versions 2 and 3
# Run this one-liner from the Sublime Text console if you need to revert all open documents
[ view.run_command('revert') for view in sublime.Window.views(sublime.active_window()) ]
@giuseppeg
giuseppeg / my_css_modules.css
Last active June 15, 2016 10:34
A pof of how I would like CSS Modules to be. Warning this could all be bullshits! http://astexplorer.net/#/SfDfBXptzr
/** stuff.css */
:root {
--magic: {
font-size: 3em;
}
}
/** my-component.css */
/* @define MyComponent */
@sebmarkbage
sebmarkbage / Intro.md
Last active March 9, 2017 14:44
ECMAScript Tagged Object

Tagged Objects

The goal is to implement a form of pattern matching that works well in the existing dynamic environment of ECMAScript.

The goal is to find a way to do efficient pattern matching such as using an object tag. JS VMs already have a field for this that is used to tag various kinds of built-in objects.

This tag could be extended to also include a user space range.

The Mechanism

@giuseppeg
giuseppeg / debug-travisci-locally.sh
Created March 14, 2017 15:02
Debug Travis CI locally
# Pull and run an image.
# TAGNAME is one of https://quay.io/repository/travisci/ci-nodejs?tab=tags
docker run --name travis-debug -dit quay.io/travisci/ci-nodejs:TAGNAME /sbin/init
docker exec -it travis-debug bash -l
su - travis
cd builds
# install node
nvm install 7
# clone your repo
git clone https://github.com/user/repo.git
@spinda
spinda / jsequalityimpl.md
Last active March 15, 2017 21:50
js equality implementation (in spidermonkey)

explanation of https://twitter.com/getify/status/780249160662605824 in terms of SpiderMonkey (Firefox) internals

edit: The tweet linked above has since been deleted, but the original code read something like:

' \t\n\r\u000c\u000b\uFEFF\u0020' == 0 // true
  1. The script is parsed and compiled to bytecode.
@muratgozel
muratgozel / jss-postcss-precompile-example.js
Last active May 28, 2017 18:51
Use jss and postcss together in your project.
// If you are planning to use postcss plugins like autoprefixer,
//you probably should precompile your jss style objects with postcss-js before running your app.
// Because autoprefixer makes a network request and loads caniusedb json file into your bundle
//and this will dramaticly increase the size of your bundle.
// So lets create a precompile script
// Following 2 library needed for writing compiled jss style objects to files
var fs = require("fs");
var stringifyObject = require("stringify-object");
@threepointone
threepointone / deferred.js
Created December 29, 2016 14:38
deferred render with react fiber
/* global React, ReactDOMFiber */
/* @jsx deferElement */
const { render, unstable_deferredUpdates } = ReactDOMFiber
class Deferred extends React.Component {
state = { next: false }
componentDidMount() {
unstable_deferredUpdates(() =>
this.setState(state => ({ next: true })))
}
show_icons() {
defaults write com.apple.finder CreateDesktop true
killall Finder
}
hide_icons() {
defaults write com.apple.finder CreateDesktop false
killall Finder
}
var Hogan = require('./twitter-hogan');
var renderOptions = { asString: true, sectionTags: [{ o: '_i', c: 'i' }] };
var translateMustache = require('./translate-mustache');
function extractPartials(tmpl) {
// need eval to pull the partials out of the Hogan-generated string
/* eslint-disable no-eval */
var hoganParams = eval(`(${tmpl})`);
/* eslint-enable no-eval */
var partialNames = [];