Skip to content

Instantly share code, notes, and snippets.

@vicalloy
vicalloy / t.swift
Created January 7, 2019 00:50
file bookmark
// APP
@IBAction func opx(_ sender: Any) {
// let openFileTypes = ["*"]
let openPanel = NSOpenPanel()
openPanel.allowsMultipleSelection = false
openPanel.canChooseDirectories = true
openPanel.canCreateDirectories = false
openPanel.canChooseFiles = true
@vicalloy
vicalloy / webhook.py
Created June 20, 2018 05:18
Github event handler
from bottle import abort
from bottle import post
from bottle import request
from bottle import run
from subprocess import call
def handle_pull_request(o):
pass
@vicalloy
vicalloy / money.py
Last active April 26, 2017 06:47
money
import random
def get_pkg(total_money, pkg_count):
pkg = random.randint(1, int(total_money * 2 / pkg_count))
if (total_money - pkg) < (pkg_count - 1):
return get_pkg(total_money, pkg_count)
return pkg
@vicalloy
vicalloy / gist:4603625
Last active October 23, 2019 21:09
[coffeescript] maze generator
fmtTime = (t) ->
d = new Date(null);
d.setSeconds(t/1000);
return d.toTimeString().substr 3, 5
move = (obj, direction, step) ->
if !step?
step = 10
attr = 'left'
@vicalloy
vicalloy / gist:4593240
Last active December 10, 2019 19:46
[python] maze generator
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import random
try:
from tkinter import *
except ImportError:
from Tkinter import *
class Block(object):