Skip to content

Instantly share code, notes, and snippets.

View therebelrobot's full-sized avatar
A girl made of PLA and caffeine

Aster Haven therebelrobot

A girl made of PLA and caffeine
View GitHub Profile
@kfranqueiro
kfranqueiro / README.md
Last active September 11, 2020 16:16
Rudimentary visual regression testing strategery

Introduction

This gist documents the setup I originally used to run visual diffs on the MDC Web demo pages for testing material-components/material-components-web#1285, but I have used it since then on other projects.

Setup

  1. Create a directory containing the js and txt files from this gist
  2. npm i

Process

@nijikokun
nijikokun / doc.md
Last active May 10, 2024 00:33
Building Javascript Frontend / Backend Applications

Document for the best design choices you can make for your software.

Terminology

  • DDD - [Domain Driven Design][ddd-wikipedia]
  • FF or FTF - Function First Design, or File-type First Design is structuring your application by it's function before the files such as a directory named components containing all component files.

File Structure

Structuring applications is hard, here are a few resources to help.

@nijikokun
nijikokun / pify.js
Created June 24, 2016 01:15
< 35 line promisify that works in browsers and node.js
function pify (method, context) {
var resolver, rejector
var error, success
var done = false
var promise = {
then: function (a) {
if (!done && success != null) done = true, a(success); else resolver = a
return { catch: promise.catch }
},
" Make IE Better Compatible "
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
======================================================
IE6 Only
==================
_selector {...}
@nijikokun
nijikokun / flow.js
Last active August 29, 2015 14:17
Async flow for ES5/6 (Purely thought / psuedocode)
flo = flow
// Add method signature and arguments to be invoked
.add(/* [name, ]function[, arguments...] */)
// Attach thenable to previous method signature
.then(function () {
// skip(/* string name | int groups */)
flo.skip('name') // this.skip vs flo.skip vs (skip argument on argument list, after next)
// next(/* string name | int group */)

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.

@morganrallen
morganrallen / _README.md
Last active January 15, 2023 19:41
Janky Browser

JankyBrowser

The only cross-platform browser that fits in a Gist!

One line install. Works on Linux, MacOSX and Windows.

Local Install

$&gt; npm install http://gist.github.com/morganrallen/f07f59802884bcdcad4a/download
@antonmedv
antonmedv / Flyspeck.js
Last active November 26, 2019 07:01
Simple and Small Dependency Injection Container inspired by Pimple.
/*
* Flyspeck is Dependency Injection Container.
*
* Copyright (c) 2014 Anton Medvedev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is furnished
@ChristianPeters
ChristianPeters / css_splitter.rake
Created August 8, 2011 10:22
Split CSS files so that there are no more than a given number of selectors in one style sheet. This is a tool to cope with Internet Explorer's limitation of max. 4095 selectors per stylesheet.
require 'rake'
require 'css_splitter'
desc 'split css files'
namespace :css do
task :split do
infile = ENV['infile'] || raise("missing infile")
outdir = ENV['outdir'] || File.dirname(infile)
max_selectors = ENV['max_selectors'] || 4095