Skip to content

Instantly share code, notes, and snippets.

View lumixraku's full-sized avatar
🌴
On vacation

lumix lumixraku

🌴
On vacation
View GitHub Profile
@lumixraku
lumixraku / converts-webfont-to-base64.js
Created November 9, 2015 11:59 — forked from arielsalminen/converts-webfont-to-base64.js
Convert Google WOFF font to base64 format and inline to <head> of document
// Get binary file using XMLHttpRequest
function getBinary(file) {
var xhr = new XMLHttpRequest();
xhr.open("GET", file, false);
xhr.overrideMimeType("text/plain; charset=x-user-defined");
xhr.send(null);
return xhr.responseText;
}
// Base64 encode binary string
@lumixraku
lumixraku / ProgrammaticNotebook.ipynb
Created April 27, 2018 06:41 — forked from fperez/ProgrammaticNotebook.ipynb
Creating an IPython Notebook programatically
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lumixraku
lumixraku / config.fish
Created September 14, 2018 14:09 — forked from fmariluis/config.fish
Basic configuration for Fish Shell
set -xg PYTHONPATH /opt/eleccion/ $PYTHONPATH
set -xg PYTHONPATH /opt/operaciones/ $PYTHONPATH
set -xg GOROOT /usr/local/go $GOROOT
set -xg PATH /usr/local/go/bin $PATH
set -xg EDITOR vim $EDITOR
setenv EDITOR vim
function l
ll $argv
@lumixraku
lumixraku / 01_basic.go
Created November 6, 2018 02:49 — forked from reagent/00_README.md
Custom HTTP Routing in Go
package main
import (
"io"
"log"
"net/http"
)
func main() {
@lumixraku
lumixraku / sleep&wake.js
Last active May 18, 2020 09:30
Phaser Sleep and wake
var SceneA = new Phaser.Class({
Extends: Phaser.Scene,
initialize:
function SceneB ()
{
Phaser.Scene.call(this, 'sceneA');
@lumixraku
lumixraku / sleep&wake&switch.js
Last active May 18, 2020 09:29
Phaser sleep & wake (using switch)
var SceneA = new Phaser.Class({
Extends: Phaser.Scene,
initialize:
function SceneB() {
Phaser.Scene.call(this, 'sceneA');
this.pic;
class Http {
public static Inst(): Http {
if (null == Http._inst) {
Http._inst = new Http();
}
return Http._inst;
}
private static _inst: Http;
public constructor() {
@lumixraku
lumixraku / splitarr.js
Created September 11, 2020 14:48
数组分组
const listChunk = (list, size = 1, cacheList = []) => {
const tmp = [...list]
if (size <= 0) {
return cacheList
}
while (tmp.length) {
cacheList.push(tmp.splice(0, size))
}
return cacheList
}
@lumixraku
lumixraku / curry.js
Last active September 11, 2020 16:01
const curring = fn => {
const { length } = fn
const curried = (...args) => {
return (args.length >= length
? fn(...args)
: (...args2) => curried(...args.concat(args2)))
}
return curried
}
// 运用正则去掉空格
' s123s'.replace(/^(\s*)(.+)(\s*)$/, '$2')
// 日期操作
const dataPattern = (str, format = '-') => {
if (!str) {
return new Date()
}
const dateReg = new RegExp(`^(\\d{2})${format}(\\d{2})${format}(\\d{4})$`)
const [, month, day, year] = dateReg.exec(str)