Skip to content

Instantly share code, notes, and snippets.

@veggiemonk
veggiemonk / inlineworker.js
Created January 15, 2017 14:57 — forked from SunboX/inlineworker.js
Create web workers without a separate worker JS files. Source: http://jsbin.com/owogib/8/
function worker() {
setInterval(function() {
postMessage({foo: "bar"});
}, 1000);
}
var code = worker.toString();
code = code.substring(code.indexOf("{")+1, code.lastIndexOf("}"));
var blob = new Blob([code], {type: "application/javascript"});
@veggiemonk
veggiemonk / email-address-syntax-validation-let-the-browser-do-it.md
Created December 7, 2016 03:03 — forked from nepsilon/email-address-syntax-validation-let-the-browser-do-it.md
Email address syntax validation? Let the browser do it (without regexp) — First published in fullweb.io issue #77

Email address syntax validation? Let the browser do it (without regexp)

Here is a simple and robust way to check for the validity of an email address syntax directly in the browser. No need for crazy regular expressions.

e = document.createElement('input')
e.type = 'email'
// check some email addresses
e.value = 'hi@'
;;;;;;;;;;;;;;;;;;;
;; Collections in Clojure
;;;;;;;;;;;;;;;;;;;
;; Distinctive characteristics
;;;;;;;;;;;;;;;;;;;
;; * They are mainly used in terms of abstractions, not the details of concrete implementations.
;; * They are immutable and persistent.
;;;;;;;;;;;;;;;;;;;
@veggiemonk
veggiemonk / vpn_psk_bingo.md
Created November 29, 2016 03:57 — forked from kennwhite/vpn_psk_bingo.md
Most VPN Services are Terrible
@veggiemonk
veggiemonk / all-lein-templates.txt
Created November 24, 2016 04:28 — forked from anonymous/all-lein-templates.txt
for i in {1..28} ; do lein search lein-template $i ; done | grep '^\[' | perl -pe 's,^\[,,; s,/.*?],:,' | sort | uniq -c | tee all-lein-templates.txt
1 acorn: A Leiningen template for a ClojureScript setup with Figwheel, Austin, Om.
8 amp: Leiningen template for AMP (Alfresco Module Package) projects.
1 angular-cl2: A Leiningen template for using AngularJS and ChlorineJS
1 angular: Clojure and AngularJS in perfect harmony.
6 angular: Clojure and AngularJS in perfect harmony. $ lein new angular <name>
2 angularjs-app: Leiningen template for web application with http-kit and angularjs
5 angular-simple: Clojure and AngularJS $ lein new angular-simple <name>
1 aperiodic-cljs: My cljs development starting point. Basically ripped from lein-cljsbuild.
1 apijr: clojurescript project template
1 appfgo: 'lein new' template for Funcgo application
@veggiemonk
veggiemonk / app.js
Created December 17, 2015 12:15 — forked from peteruithoven/app.js
Rehydrating Redux store when using systemjs hot reloader
import {createStore} from 'redux';
import reducer from './reducers/index.js'
import { rehydrate, rehydratingStore } from './utils/rehydratingStore.js';
const store = rehydratingStore()(createStore)(reducer);
export function __reload(deletedModule){
const prevState = deletedModule.getState();
debug('Reloaded. rehydrate with state: ', prevState.sketcher.objectsById);
store.dispatch(rehydrate(prevState));
@veggiemonk
veggiemonk / ajax-loader.scss
Created December 15, 2015 09:04 — forked from gilbert/ajax-loader.scss
Global Mithril.js AJAX Loader
// Taken from http://loading.io/
uiload {
display: inline-block;
position: relative;
& > div {
position: relative;
}
}
@-webkit-keyframes ajax-loader {
@veggiemonk
veggiemonk / index.html
Created November 30, 2015 17:04 — forked from anonymous/index.html
JS Bin unique routes for page with/without overlay // source http://jsbin.com/zutisu
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="unique routes for page with/without overlay">
<meta charset="utf-8">
<title>JS Bin</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/mithril/0.2.0/mithril.min.js"></script>
<style id="jsbin-css">
div.overlay {
position: absolute;
var Modal = {
controller: function() {
return {isVisible: false} //internal state
},
view: function() {
return m(".modal", {
class: ctrl.visible ? ".modal-visible" : "" //sets visibility via CSS
config: function(el, init) {
if (!init) {
//jQuery-exposed API
@veggiemonk
veggiemonk / index.html
Created November 29, 2015 21:14 — forked from anonymous/index.html
Mithril experiment mithriljs: Mithril template // source http://jsbin.com/radaze
<!DOCTYPE html>
<html>
<head>
<title>Mithril experiment</title>
<meta name="description" content="mithriljs: Mithril template">
<meta charset="utf-8">
<script>
window.log = function(){
log.history = log.history || []; // store logs to an array for reference