Skip to content

Instantly share code, notes, and snippets.

View omgmog's full-sized avatar
⌨️

Max Glenister omgmog

⌨️
View GitHub Profile
@omgmog
omgmog / audio-processing.sh
Last active February 20, 2019 18:41
Audio processing bash functions for OSX
# Convert mp3 files to wav
# Usage: for file in *.mp3; do mp3towav $file; done
mp3towav() {
afconvert -f WAVE -d LEI16@44100 "$1"
}
# Trim silence from start/end of files
# Usage: for file in *.wav; do trimsilence $file; done
trimsilence() {
mkdir -p trimmed
@omgmog
omgmog / bitwisetiles.p8
Last active February 15, 2019 16:50
Apply tiles from a tileset based on their neighbors
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
--init
_t=0
dirx={-1,1,0,0,1,1,-1,-1}
diry={0,0,-1,1,-1,1,1,-1}
tiles={16,8,15,7,12,4,11,3,14,6,13,5,10,2,9,0}
function _init()
_upd=upd_game
@omgmog
omgmog / explosion-effect.p8
Created February 9, 2019 11:35
An explosion particle effect
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
--init
function _init()
-- hold debug messages
debug={}
particles={}
p_colors = {5,6,7,10,9,5}
@omgmog
omgmog / outline.p8
Last active February 5, 2019 19:51
example of outline text and sprites, and also palette swapping...
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
function _init()
_t=0
sprites={1,2,3,4}
end
function _update()
_t+=1
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
function _init()
x=-40
y=64
body={1,3}
head={5,7}
s={
@omgmog
omgmog / jekyll-to-grav.js
Last active February 4, 2019 09:05
Port Jekyll posts to Grav CMS
const fs = require('fs');
const glob = require('glob');
const fm = require('front-matter');
const path = require('path');
const write = require('write');
glob("!(node_modules)/**/*.md", {}, (err, files) => {
files.forEach((file) => {
fs.readFile(file, 'utf8', (err, data) => {
if (err) throw err;
@omgmog
omgmog / menu-system.p8
Created February 3, 2019 00:47
Pico-8 menu system
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
-- init
function _init()
_sfx = {
select = 0,
move = 1,
no = 2
}
@omgmog
omgmog / jquery_disqus_lazyload.js
Created April 5, 2012 13:19 — forked from muratcorlu/jquery_disqus_lazyload.js
Load disqus comments when visitor scroll down page to comments
/**
* Load disqus comments when visitor scroll down page to comments
*
* Usage:
* Add a div with id "disqus_thread" and data attributes for every disqus parameter:
*
* <div id="disqus_thread" data-disqus-shortname="username" data-disqus-url="http://example.com/post/post-name/"></div>
*
* @author: Murat Corlu
* @link: https://gist.github.com/gists/2290198
@omgmog
omgmog / arkanoid.p8
Last active August 4, 2018 10:37
Arkanoid (wip) - following the Pico-8 Hero video series
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
function center(width)
return (screen_width / 2) - (width / 2)
end
function _init()
cls()
@omgmog
omgmog / cog.p8
Last active August 1, 2018 20:52
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
function sleep(s)
for i=1,s*30 do
flip()
end
end
c = 0