Skip to content

Instantly share code, notes, and snippets.

View EloB's full-sized avatar
🚀
The World Is Mine

Olle Bröms EloB

🚀
The World Is Mine
View GitHub Profile
@EloB
EloB / helper.js
Created May 4, 2016 07:59
Better error output in console
if (process.env.NODE_ENV === 'development') {
const output = e => {
const encoded = encodeURI(e.message);
console.error(`Error: ${e.stack}\n\nSearch for information:\n- http://stackoverflow.com/search?q=${encoded}\n- https://www.google.se/#q=${encoded}`);
};
if (process.platform) {
process.on('uncaughtException', output); // Serverside
} else {
window.addEventListener('error', output, false); // Clientside
}
@EloB
EloB / index.js
Created April 28, 2016 09:03
Bundle
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (process){
'use strict';
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@EloB
EloB / bundle.js
Last active April 15, 2016 13:42
Material-ui bundle
This file has been truncated, but you can view the full file.
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
require('react');
require('react-dom');
require('react-router');
require('material-ui');
require('react-tap-event-plugin');
global.require = require;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
@EloB
EloB / index.html
Created February 27, 2016 22:10 — forked from nolanlawson/index.html
WebSQL full-text search demo (open in Chrome or Safari)
<html>
<body>
<pre id="output"></pre>
<script src="//cdn.jsdelivr.net/jquery/2.1.1/jquery.js"></script>
<script>
var $output = $('#output');
var db = openDatabase('fts_demo', 1, 'fts_demo', 5000000);
db.transaction(function (tx){
@EloB
EloB / docker-compose.yml
Created December 23, 2015 12:46
Docker compose yml hello world example
helloworld:
image: ubuntu:14.04
command: /bin/echo 'Hello world'
@EloB
EloB / gist:a0ee602489939b63dc41
Created June 14, 2015 18:36
Toggle path hints magento bookmarklet
javascript:var key,pattern,search%3Bif(!localStorage.easyTemplatePathKey)%7Bkey%3Dprompt(%27Easy template path hints code%27,%27magento%27)%3Bif(key!%3D%3Dnull)%7BlocalStorage.easyTemplatePathKey%3Dkey%3B%7D%7Dkey%3DlocalStorage.easyTemplatePathKey%3Bif(key!%3D%3Dnull)%7Bpattern%3Dnew RegExp(%27%26%3Ftp%3D1%26code%3D%27%2Bkey)%3Bsearch%3D(location.search.indexOf(%27%3F%27)%3D%3D%3D0%3F%27%27:%27%3F%27)%2B(pattern.test(location.search)%3Flocation.search.replace(pattern,%27%27):((location.search.length>1%3F%27%26%27:%27%27)%2B%27tp%3D1%26code%3D%27%2Bkey))%3Bsearch%3Dsearch.length>1%3Fsearch:%27%27%3Blocation.href%3Dlocation.protocol%2B%27//%27%2Blocation.host%2Blocation.pathname%2Bsearch%2Blocation.hash%3B%7D
@EloB
EloB / regexp.html
Created June 7, 2015 14:54
Why is this regexp slow?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Slow regexp</title>
</head>
<body>
<script>
function convertHtmlToText(html) {
el.innerHTML = html;
@EloB
EloB / file1.js
Created January 16, 2015 15:25
Node require recursion example
exports.hello = 'world1';
exports.file2 = require('./file2');
exports.file3 = require('./file3');
@EloB
EloB / extends.jade
Last active August 29, 2015 14:12
Jade bug?
block content
@EloB
EloB / Gruntfile.js
Created February 22, 2014 15:08
I have found out what triggers the error. It's when I have a package.json file that contains the private property.
/* jshint node: true */
module.export = function() {
};