This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- All the letters that can be matched by the regex, we only care | |
-- about capitals for this problem | |
allLetters = Set.fromList ['A'..'Z'] | |
compile :: String -> [Instruction Char] | |
compile xs = (compile' xs) ++ [End] | |
where compile' [] = [] | |
compile' xs = let (instr, rest) = compilePart xs in | |
instr ++ compile' rest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S E C U E * * | |
M L R C R L * * | |
M M X O X R X * H | |
H E M H * * H * * H | |
H H X M I * H H X D C | |
H P R R M I . * H D D C | |
S T X * C M I . C R X R G | |
A M * M M C M R C R C R | |
H O X M M C C * X R N | |
E M N M N C R E C R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.*SE.*UE.* | |
.*LR.*RL.* | |
.*OXR.* | |
([^EMC]|EM)* | |
(HHX|[^HX])* | |
.*PRR.*DDC.* | |
.* | |
[AM]*CM(RC)*R? | |
([^MC]|MM|CC)* | |
(E|CR|MN)* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
item_ids = request.QUERY_PARAMS.get('item_models', '').split(',') | |
items = ItemModel.objects.filter(id__in=item_ids) | |
result = dict( | |
(m.pk, {'lowest_stock': m.get_lowest_stock_for_subbooking(subbooking)}) | |
for m in items} | |
return Response(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Readable = require('stream').Readable; | |
var util = require('util'); | |
function Source(options, generator) { | |
if (typeof options === 'function') { | |
generator = options; | |
options = {}; | |
} | |
this._generator = generator(); | |
Readable.call(this, options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function play (x) { | |
x += '' | |
r = [] | |
for (i = -1; ++i < x.length;) | |
r.push('zero two three five six seven eight'.split(' ')[x[i]]) | |
return r.join(' ') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function play (n) { | |
return n + 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
play=p=function (s) { | |
return s.replace(/\b./g, p.call.bind(s.toUpperCase)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var shallowEqual = require('shallow-equals'); | |
// Create a mixin for a component that depends on a store(s) for | |
// state. Component should define getStateFromStores | |
module.exports = function StoreWatchMixin(...stores) { | |
return { | |
componentDidMount () { | |
stores.forEach((store) => { | |
store.addListener('change', this.onStoreChange); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XMonad | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Util.Run(spawnPipe) | |
import XMonad.Util.EZConfig(additionalKeys) | |
import System.IO | |
main = do | |
xmonad $ defaultConfig { | |
modMask = mod4Mask -- Rebind Mod to the Windows key |
OlderNewer