Skip to content

Instantly share code, notes, and snippets.

View itsMapleLeaf's full-sized avatar

Darius itsMapleLeaf

View GitHub Profile
module lexer


interface LexerState
  source: string
  current: number
  tokens: Token[]

interface Token
@itsMapleLeaf
itsMapleLeaf / app.js
Last active June 7, 2016 15:41
JSON request error "invalid username"
const encode = encodeURIComponent
const url = "https://www.f-list.net/json/getApiTicket.php"
const params = `account=${encode(account)}&password=${encode(password)}`
const request = new XMLHttpRequest
request.onreadystatechange = function () {
if (request.readyState === XMLHttpRequest.DONE && request.status === 200) {
console.log(request.responseText)
}
import querystring from 'querystring'
export default function request(url, params) {
return new Promise((resolve, reject) => {
const paramstring = querystring.stringify(params)
const request = new XMLHttpRequest
request.onreadystatechange = function () {
if (request.readyState === XMLHttpRequest.DONE) {
if (request.status == 200) {
<template>
<div class='fullscreen bg-color'>
<chat></chat>
<component :is='currentOverlay'
@login-request='loginRequest'
@login-success='loginSuccess'
@character-selected='characterSelected'
@channel-list-clicked='channelListClicked'>
</component>
</div>
<template lang="jade">
.container
.calculator
.row
.result.col-4 0
.row
.button-operator.col-1 +
.button-operator.col-1 -
.button-operator.col-1 *
.button-operator.col-1 /
<template>
<body class='container'>
<transition name='fade' mode='out-in' appear>
<component v-if='currentView' :is='currentView' />
</transition>
<transition name='fade' appear>
<Loading v-if='loadingMessage'>{{ loadingMessage }}</Loading>
</transition>
</body>
</template>
@itsMapleLeaf
itsMapleLeaf / default.lua
Created September 20, 2016 00:25
SM5 Mods
-- luacheck: globals Def GAMESTATE SCREENMAN
local DefaultMods = '4x, overhead, blind'
-- format: { <beat>, 'len' or 'end', <len or end time>, <mod string>, <player number (optional, if not here, applies to all players)> }
-- example: { 0, 'len', 9999, '*0.5 200% dizzy' }
local SongMods = {
-- ...
}
@itsMapleLeaf
itsMapleLeaf / delegation.js
Created December 3, 2016 00:49
Inheritance vs Composition/Delegation
class Rect {
constructor(x, y, w, h) {
this.x = x
this.y = y
this.w = w
this.h = h
}
move(dx, dy) {
// ...
import * as pixi from 'pixi.js'
import * as util from './util'
export const viewWidth = 540
export const viewHeight = 960
export const receptorPosition = viewHeight * 0.889
export const noteSpacing = 300
enum NoteState {
active,
@itsMapleLeaf
itsMapleLeaf / auto-resize-tree-view.less
Created March 24, 2017 22:16
Styles for an automatically resizing tree-view
.tree-view-resizer {
width: max-content;
}
// hide the resize handle so we don't accidentally break things
.tree-view-resize-handle {
display: none;
}
// add some padding for breathing room (optional)