Skip to content

Instantly share code, notes, and snippets.

@taion
taion / foo.entrypoint.js
Last active August 14, 2020 14:52
Router strawman
// You can imagine some shorthand for generating this given a component and
// a Relay query.
import React from 'react';
import getFoo from './getFoo';
import lazyComponent from './lazyComponent';
export default function fooEntrypoint({ fooId }) {
const Component = lazyComponent(import('Foo'));
@kastermester
kastermester / es-preset.js
Created October 25, 2016 11:51
Webpack hot reloading of relay schemas
// loaction: loaders/es-preset.js
// This file is a combination of the following babel presets:
// es2015, react, stage-0.
// Difference is that the es2015-template-literals is taken out. Of the es2015 preset.
// This allows us to run relay transformations on the code afterwards (which will then transform any remaining template literals).
module.exports = preset({});
function preset(context, opts) {
var moduleTypes = ["commonjs", "amd", "umd", "systemjs"];
var loose = false;
@jirutka
jirutka / -README.md
Last active October 31, 2023 09:07
How to use terminal on Windows and don’t go crazy…

How to use terminal on Windows without going crazy…

Windows is really horrible system for developers and especially for devops. It doesn’t even have a usable terminal and shell, so working with command line is really pain in the ass. If you really don’t want to switch to any usable system (OS X, Linux, BSD…), then this guide should help you to setup somewhat reasonable environment – usable terminal, proper shell, ssh client, git and Sublime Text as a default editor for shell.

Install stuff

  1. Download and install Git for Windows* with:
    • [✘] Use Git from the Windows Command Prompt
  • [✘] Checkout as-is, commit Unix-style line endings
@sebmarkbage
sebmarkbage / ElementFactoriesAndJSX.md
Last active May 17, 2022 11:06
New React Element Factories and JSX

New React Element Factories and JSX

In React 0.12, we're making a core change to how React.createClass(...) and JSX works.

If you're using JSX in the typical way for all (and only) React components, then this transition will be seamless. Otherwise there are some minor breaking changes described below.

The Problem

@pascalduez
pascalduez / SassMeister-input.scss
Last active December 20, 2023 20:38
Some Sass string functions: capitalize, ucwords, camelize, ...
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
// Capitalize string
// --------------------------------------------------------------------------------
// @param [string] $string
// --------------------------------------------------------------------------------
// @return [string]
@petsel
petsel / The-many-Talents-of-JavaScript.md
Last active February 21, 2017 11:33
The-many-Talents-of-JavaScript.md

#The many »Talents« of JavaScript

[TOC]

##The many talents of JavaScript for generalizing Role Oriented Programming approaches like Traits and Mixins

###TL;DR / Summary

@james2doyle
james2doyle / scrollTo.js
Last active November 29, 2023 11:41
a native scrollTo function in javascript that uses requestAnimationFrame and easing for animation
// easing functions http://goo.gl/5HLl8
Math.easeInOutQuad = function (t, b, c, d) {
t /= d/2;
if (t < 1) {
return c/2*t*t + b
}
t--;
return -c/2 * (t*(t-2) - 1) + b;
};
@darkyen
darkyen / Id3NodeReader.js
Created April 24, 2012 17:23
A simple ID3v2.3.0 Tag Reader written for node.js
var fs = require('fs');
var Buffer = require('buffer').Buffer;
var id3Reader = new (function(){
// Credits to esailja //
var self = this;
function id3Size( buffer ) {
var integer = ( ( buffer[0] & 0x7F ) << 21 ) |
( ( buffer[1] & 0x7F ) << 14 ) |
( ( buffer[2] & 0x7F ) << 7 ) |