Skip to content

Instantly share code, notes, and snippets.

@nakamorichi
nakamorichi / absolute-to-relative.ts
Created June 9, 2017 04:51
Script for converting absolute module paths to relative
import * as Path from 'path';
import * as recursive from 'recursive-readdir';
import * as Fs from 'fs';
import * as xregexp from 'xregexp';
const root = Path.resolve(__dirname, '..');
recursive(root, ['!*.js'], (error, files) => {
files.forEach(file => {
const fileContent = Fs.readFileSync(file, 'utf-8');
@coronarob
coronarob / countdowntimer.lua
Last active August 29, 2015 14:20
A sample countdown timer
display.setDefault("background", 0.2, 0.2, 0.4 )
-- Keep track of time in seconds
local secondsLeft = 20 * 60 -- 20 minutes * 60 seconds
local clockText = display.newText("20:00", display.contentCenterX, 80, native.systemFontBold, 80)
clockText:setFillColor( 0.7, 0.7, 1 )
local function updateTime()
-- decrement the number of seconds
@wiiiim
wiiiim / main.lua
Last active September 23, 2016 03:57
Springboard for Corona SDK, based on widget.scrollView
local springboard = require("springboard")
local group = display.newGroup() -- root display group
local pageTotal = 3
local board -- springboard instance
local pageDots = {} -- dots at the top
local function animatePageDot() -- called each time the springboard changes page
local currentPage = board.page
-- reset all pagedots
@beala
beala / perm.py
Created May 5, 2012 19:37
Permutations interview question.
# Print each permutation.
def perm(l, n, str_a):
if len(str_a) == n:
print str_a
else:
for c in l:
perm(l, n, str_a+c)
# Return a list of permutations.
def perm2(l, n, str_a, perm_a):