Skip to content

Instantly share code, notes, and snippets.

View MobliMic's full-sized avatar
:bowtie:
React.js init

Michael Craddock MobliMic

:bowtie:
React.js init
View GitHub Profile
@seeliang
seeliang / lint-only-changed-files.MD
Last active June 10, 2024 05:37
How to lint only changed files?

find out the differences

use git diff to generate file list

git diff --name-only master

limited to certain file types

add ext filter

@bo01ean
bo01ean / webpack.config.js
Created February 28, 2019 09:20
swc-loader for create-react-app webpack
'use strict';
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const resolve = require('resolve');
const PnpWebpackPlugin = require('pnp-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
@tkfu
tkfu / srd_5e_monsters.json
Last active July 20, 2024 04:31
A JSON file with all the D&D 5e SRD monster data
[
{
"name": "Aboleth",
"meta": "Large aberration, lawful evil",
"Armor Class": "17 (Natural Armor)",
"Hit Points": "135 (18d10 + 36)",
"Speed": "10 ft., swim 40 ft. ",
"STR": "21",
"STR_mod": "(+5)",
"DEX": "9",
@ryanmaffey
ryanmaffey / oneWayWindowResizeEvents.js
Last active June 28, 2017 11:22
Dispatches events on the window object whenever the screen is resized horizontally or vertically (or both).
/*******************************************************************************
* One way screen resize events.
* =============================
* Dispatches events on the window object whenever the screen is resized
* horizontally or vertically (or both).
*
* Horizontal resize.
* ------------------
* If the screen has been resized horizontally, the "horizontalResize" event is
* dispatched. Example usage:
@marcysutton
marcysutton / enzyme-test.js
Last active August 23, 2021 08:20
React A11y Testing
import {expect} from 'chai';
import App from '../app/components/App';
import a11yHelper from "./a11yHelper";
describe('Accessibility', function () {
this.timeout(10000);
it('Has no errors', function () {
let config = {};
@taoyuan
taoyuan / npm-using-https-for-git.sh
Last active July 18, 2024 05:36
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@jacopotarantino
jacopotarantino / twerkify.js
Created October 12, 2015 14:59
Twerkify - Make your website twerk.
(function () {
'use strict'
/**
* @module Twerkify
* @description Thank you for twerking. Use at your own risk.
*/
console.log('Thank you for twerking')
var json_request
@paulirish
paulirish / what-forces-layout.md
Last active July 20, 2024 17:43
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@romainl
romainl / gist:9970697
Last active June 1, 2024 03:21
How to use Tim Pope's Pathogen

How to use Tim Pope’s Pathogen

I’ll assume you are on Linux or Mac OSX. For Windows, replace ~/.vim/ with $HOME\vimfiles\ and forward slashes with backward slashes.

The idea

Vim plugins can be single scripts or collections of specialized scripts that you are supposed to put in “standard” locations under your ~/.vim/ directory. Syntax scripts go into ~/.vim/syntax/, plugin scripts go into ~/.vim/plugin, documentation goes into ~/.vim/doc/ and so on. That design can lead to a messy config where it quickly becomes hard to manage your plugins.

This is not the place to explain the technicalities behind Pathogen but the basic concept is quite straightforward: each plugin lives in its own directory under ~/.vim/bundle/, where each directory simulates the standard structure of your ~/.vim/ directory.

@tarwn
tarwn / RAINBOWlog.js
Created March 13, 2014 02:08
Awesomify-er your console.log - extended from https://gist.github.com/LeaVerou/9518902
(function(){
var log = console.log;
console.log = function(str) {
var css = 'background-image: url("http://fc07.deviantart.net/fs70/f/2013/090/3/5/ocs____seine_unicorn_sprite_by_onisuu-d5zuuax.gif"), linear-gradient(to right, red, yellow, lime, aqua, blue, fuchsia, red); background-repeat: no-repeat, no-repeat; padding-left: 20px; color: white; font-weight: bold; font-size: 12pt; text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;';
var args = Array.prototype.slice.call(arguments);
args[0] = '%c ' + args[0];
args.splice(1,0,css);
return log.apply(console, args);
}