Skip to content

Instantly share code, notes, and snippets.

@snowmantw
snowmantw / gist:737f621c6484d561b408
Created August 13, 2015 07:19
Possible error of Mulet Intl
RUNTIME=/home/snowmantw/debugmulet/firefox/firefox TEST_FILES=/home/snowmantw/debugmulet/gaia/apps/system/test/marionette/lockscreen_media_playback_test.js make test-integration-test
TEST_MANIFEST=/home/snowmantw/debugmulet/gaia/shared/test/integration/local-manifest.json npm run marionette -- --buildapp="desktop" --reporter="spec"
> gaia@0.0.3 marionette /home/snowmantw/debugmulet/gaia
> gaia-marionette "--buildapp=desktop" "--reporter=spec"
+ export MOZ_DISABLE_NONLOCAL_CONNECTIONS=1
+ MOZ_DISABLE_NONLOCAL_CONNECTIONS=1
+ SOURCE=/home/snowmantw/debugmulet/gaia/node_modules/.bin/gaia-marionette
+++ dirname /home/snowmantw/debugmulet/gaia/node_modules/.bin/gaia-marionette
@snowmantw
snowmantw / gist:b12b7a844b61f01fc672
Last active August 29, 2015 14:20
A hack to run Raptor with Marionette
'use strict';
marionette('LockScreen media playback tests', function() {
var LockScreenMediaPlaybackActions, actions;
var LockScreenMediaPlaybackChecks, checks;
var FakeMusic = require('./lib/media_playback_fake_music.js');
var fakeMusicInfo = new FakeMusic();
var apps = {};
apps[fakeMusicInfo.origin] = fakeMusicInfo.path;
var client = marionette.client({
prefs: {
export PS1="\[\033[1;32m\]`hostname`\[\033[0m\] \[\033[1;35m\]\u\[\033[0m\]:\[\033[1;33m\]\w\[\033[0m\]$ "
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
" set up pathogen, https://github.com/tpope/vim-pathogen
filetype on " without this vim emits a zero exit status, later, because of :ft off
filetype off
call pathogen#infect()
filetype plugin indent on
colorscheme advantage
" don't bother with vi compatibility
set nocompatible
@snowmantw
snowmantw / gist:06fce8d3db93dbad45b6
Created August 23, 2014 16:23
Promise.then test: parallel or sequently.
var k = new Promise((r) => {r()});
var s = () => { return new Promise((r) => { setTimeout(()=> {console.log(1); r()}, 3000) })}
var g = () => { return new Promise((r) => { setTimeout(()=> {console.log(1); r()}, 3000) })}
k.then(s).then(g) // sequently
// parallel
k.then(s)
k.then(g)
// because it should be:
{
"acknowledged_risks": true,
"skip_warning": true,
"settings": {},
"carrier":{
"phone_number": "",
"country": "",
"network": ""
},
"imei": "",
gaiatest --restart --type=b2g --app=b2gdesktop --binary=/home/cltbld/b2g/b2g-bin --profile=/home/cltbld/gaia/profile --testvars=/home/cltbld/testvars.json /home/cltbld/gaia/tests/python/gaia-ui-tests/gaiatest/tests/functional/lockscreen/test_lockscreen_unlock_to_emergency_call_screen.py
a = (D = {}, S = Init)=>(D = {d1}, S = Sa)=>(D = {d2}, S = Sb)=> doTransfer()
a()
a()()
a()()()
a()()()() ... doTransfer()
1: K = a()
if ('function' === typeof K)
goto 1
@snowmantw
snowmantw / gist:9106619
Created February 20, 2014 03:29
Use Promise without defer
t = (new Promise((s, f) => {console.log('>>',s); setTimeout(s, 6000)}))
.then(()=>{console.log('step #2');})
// The Promise constructor would receive two resolver, and call it inside the wrappered asynchrous function to trigger the next steps.
@snowmantw
snowmantw / gist:8708585
Created January 30, 2014 13:44
Haskell and map/reduce
{-# LANGUAGE UnicodeSyntax #-}
-- Pardon me. Crying for the missing lambda charater on the keybord.
-- Let's construct queries from SQL statements.
makeQueries strs = map λstr → prepare conn str
doQuery qrys = foldl (λresults query → results >> query) (return ()) qrys
-- Do query and get results.
let stmts = [ "INSERT INTO Articles ('Functional JavaScript')"
, "INSERT INTO Gecko VALUES ('30.a1')"