Skip to content

Instantly share code, notes, and snippets.

function verify_uglifyjs_error {
# Create stub dependency
echo "module.exports = class {}" >> node_modules/es6-sample.js
# Save App.js, we're going to modify it
cp src/App.js src/App.js.bak
# Add an es6 dependency
echo "import es6 from 'es6-sample'" | cat - src/App.js > src/App.js.temp && mv src/App.js.temp src/App.js
if `npm run build` | grep -xqFe "Failed to minify the code from this file:
function verify_uglifyjs_error {
# Create stub dependency
echo "module.exports = class {}" >> packages/react-scripts/node_modules/es6-sample.js
# Save App.js, we're going to modify it
cp packages/react-scripts/template/src/App.js packages/react-scripts/template/src/App.js.bak
# Add an es6 dependency
echo "import es6 from 'es6-sample'" | cat - packages/react-scripts/template/src/App.js > packages/react-scripts/template/src/App.js.temp && mv packages/react-scripts/template/src/App.js.temp packages/react-scripts/template/src/App.js
@viankakrisna
viankakrisna / docker_kill.sh
Created May 22, 2017 05:46 — forked from evanscottgray/docker_kill.sh
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
find . -name \*.less -delete && find . -type d -empty -delete
<?php
class Store {
/**
* @var array
*/
public $state = [];
/**
* @param $reducer
{
"codeformatter_debug": false,
"codeformatter_php_options":
{
"syntaxes": "php", // Syntax names which must process PHP formatter
"php_path": "/usr/bin/php", // Path for PHP executable, e.g. "/usr/lib/php" or "C:/Program Files/PHP/php.exe". If empty, uses command "php" from system environments
"format_on_save": true, // Format on save. Either a boolean (true/false) or a string regexp tested on filename. Example : "^((?!.min.|vendor).)*$"
"php55_compat": false, // PHP 5.5 compatible mode
"psr1": true, // Activate PSR1 style
@viankakrisna
viankakrisna / ledux.js
Last active April 11, 2017 20:27
re-implementation of redux and react-redux by 52 LOC https://www.webpackbin.com/bins/-KhSxnW73-R4iCMwdfnW
import React from "react";
let store;
export default function createStore(
reducer,
initialState = {},
...middlewares
) {
const subscribers = [];
let newState = initialState;
function elt(name, attributes) {
var node = document.createElement(name);
if (attributes) {
for (var attr in attributes)
if (attributes.hasOwnProperty(attr))
node.setAttribute(attr, attributes[attr]);
}
for (var i = 2; i < arguments.length; i++) {
var child = arguments[i];
if (typeof child == "string")
for f in $(find $dir -name '*.php');
do
(./wp-phptidy.php replace $f)
done
for f in $(find $dir -name '*.phptidybak~');
do
(rm -f $f)
done
@viankakrisna
viankakrisna / 0_reuse_code.js
Created March 2, 2017 19:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console