Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
simonewebdesign / Dict.elm
Created July 15, 2016 16:39
Elm Dict visual representation
[ ( "path", 123 )
, ( "value", Nothing )
]
@simonewebdesign
simonewebdesign / positiveSum.hs
Last active June 16, 2016 12:13
Sum of positives in Haskell
positiveSum :: [Int] -> Int
positiveSum a =
let
positives = filter (>0) a
in
foldl (+) 0 positives
# …OR…
positiveSum :: [Int] -> Int
@simonewebdesign
simonewebdesign / build_and_release.sh
Last active June 15, 2016 16:40
Build and release a git repo, based on VERSION file
#!/bin/bash
##
# This script creates a new release by reading from VERSION file.
##
set -e # Exit on error
set +x # Debug mode (-x on, +x off)
version="$(cat VERSION)"
@simonewebdesign
simonewebdesign / log.txt
Created November 10, 2015 10:12
Error when running npm install on Linux 4.0.9-boot2docker
npm ERR! Linux 4.0.9-boot2docker
npm ERR! argv "/usr/local/nodejs/bin/node" "/usr/local/nodejs/bin/npm" "install"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read
npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
@simonewebdesign
simonewebdesign / example.sh
Last active August 29, 2015 14:25
Search and replace (sort of templating engine) in Bash
echo this is a test, then. | ./bin/post-build.sh --this that --then doo
that is a test, doo.
@simonewebdesign
simonewebdesign / orientdb-console.sh
Last active June 15, 2016 16:38
An OrientDB session using joaodubas/orientdb Docker repository
root@cc4cb3a931ad:/usr/local/src/orientdb# ./bin/console.sh
OrientDB console v.2.0.12 (build UNKNOWN@r; 2015-07-01 11:28:05+0000) www.orientechnologies.com
Type 'help' to display all the supported commands.
2015-07-20 15:36:35:427 WARNING Not enough physical memory available for DISKCACHE: 2,001MB (heap=455MB). Set lower Maximum Heap (-Xmx setting on JVM) and restart OrientDB. Now running with DISKCACHE=256MB [orientechnologies]
Installing extensions for GREMLIN language v.2.6.0
orientdb> help
AVAILABLE COMMANDS:
@simonewebdesign
simonewebdesign / curl.sh
Last active March 9, 2019 10:22
telnet to localhost example, also wget and curl examples
curl http://localhost:8080/ >> index.html # append the contents to index.html file
@simonewebdesign
simonewebdesign / foo.html.haml
Last active August 29, 2015 14:20
Fetching a RESTful resource in AngularJS (CoffeeScript)
%div{'ng-controller' => 'FooCtrl as foo'}
this is the content
%button{'ng-click' => 'foo.bar()'} Call bar()
%div{'ng-repeat' => 'report in foo.reports'}
this is one report: {{ report.reference }} {{ report.bar }}
@simonewebdesign
simonewebdesign / eventDispatcher.js
Last active August 29, 2015 14:17
Create and dispatch an event
function createAndDispatchEvent(eventName, target) {
var e = document.createEvent("HTMLEvents");
e.initEvent(eventName, true, true);
target.dispatchEvent(e);
}
@simonewebdesign
simonewebdesign / es6.js
Created March 6, 2015 15:44
Playing around with ES6
let foo = 'bar';
let fn = () => "baz";
console.log(foo);
console.log(fn());
let log = msg => console.log(msg)
log(foo);