Skip to content

Instantly share code, notes, and snippets.

@emanchado
emanchado / gist:1176395
Created August 28, 2011 08:06
Example of how to use higher order functions in Scala
object BmApp {
def bm(message: String, func: () => Unit) {
val start = System.currentTimeMillis()
func()
printf("%s: %d\n", message, System.currentTimeMillis() - start)
}
def main(args: Array[String]) {
bm("Testing Bench", () => Thread.sleep(1000))
}
@emanchado
emanchado / alphaTab.js.diff
Created October 8, 2012 18:54
Silly alphaTab patch (improves support for GuitarPro mobile-generated .gpx files)
--- lib/alphaTab/alphaTab.js 2011-01-07 23:13:06.000000000 +0100
+++ /var/www/alphatab/lib/alphaTab/alphaTab.js 2012-10-08 20:52:35.000000000 +0200
@@ -2173,8 +2173,12 @@
beat.id = Std.parseInt(beatNode.att.resolve("id"));
beat.dyn = beatNode.node.resolve("Dynamic").getInnerData();
beat.rhythmId = Std.parseInt(beatNode.node.resolve("Rhythm").att.resolve("ref"));
+ try {
beat.noteIds = this.toIntArray(beatNode.node.resolve("Notes").getInnerData());
this.gpxDocument.beats.push(beat);
+ } catch(e) {
@emanchado
emanchado / gist:3963781
Created October 27, 2012 09:42
Sort of rough alphaTab patch (improves support for GuitarPro mobile-generated .gpx files)
--- lib/alphaTab/alphaTab.js.orig 2011-01-07 23:13:06.000000000 +0100
+++ lib/alphaTab/alphaTab.js 2012-10-27 11:40:15.000000000 +0200
@@ -2173,8 +2173,12 @@
beat.id = Std.parseInt(beatNode.att.resolve("id"));
beat.dyn = beatNode.node.resolve("Dynamic").getInnerData();
beat.rhythmId = Std.parseInt(beatNode.node.resolve("Rhythm").att.resolve("ref"));
+ try {
beat.noteIds = this.toIntArray(beatNode.node.resolve("Notes").getInnerData());
this.gpxDocument.beats.push(beat);
+ } catch(e) {
@emanchado
emanchado / set-amarok-playlist.bash
Created September 7, 2014 18:08
Sets the playlist in Amarok to a given list of files, set loop mode, and play (using DBUS)
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "ERROR: Need one parameter" 2>&1
echo "SYNTAX: amarok-set-playlist [some.playlist]" 2>&1
echo "Where some.playlist is a file with one absolute path per line" 2>&1
exit 1
fi
PLAYLIST=$1
@emanchado
emanchado / keybase.md
Created September 23, 2014 19:09
Keybase proof

Keybase proof

I hereby claim:

  • I am emanchado on github.
  • I am emanchado (https://keybase.io/emanchado) on keybase.
  • I have a public key whose fingerprint is D41C 9A3F C7CD 6757 4808 A015 8588 0AE5 BD54 0EC1

To claim this, I am signing this object:

var heads = require("robohydra").heads,
RoboHydraHead = heads.RoboHydraHead,
RoboHydraHeadProxy = heads.RoboHydraHeadProxy;
module.exports.getBodyParts = function() {
return {
heads: [
new RoboHydraHead({
path: '/',
handler: function(req, res, next) {
<head>
<meta charset="utf-8" />
<title>ProseMirror test</title>
</head>
<body>
<div id="editor"></div>
<div id="content" style="display: none">
<p>First paragraph.</p>
const choo = require('choo')
const html = require('choo/html')
const app = choo()
app.model({
state: { selected: 'second' },
reducers: {
update: (data, state) => ({ selected: data })
}
})
init : Int -> Model
init count =
Model 0
type alias Model =
{ count : Int
, minCount : Int
, maxCount : Int
view : Model -> Html Msg
view model =
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [ countStyle ] [ text (toString model.count) ]
, button [ onClick Increment ] [ text "+" ]
, span [] [ text (" Min: " ++ (toString model.minCount)) ]
, span [] [ text (" Max: " ++ (toString model.maxCount)) ]
, span [] [ text (" Times clicked: " ++ (toString model.numberClicks)) ]