Skip to content

Instantly share code, notes, and snippets.

@plugnburn
plugnburn / mobile-meta.html
Last active April 16, 2016 01:54
A reference set of mobile meta tags for quick pasting
<!-- general features -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="format-detection" content="telephone=no"> <!-- iOS & Android -->
<meta name="format-detection" content="address=no"> <!-- iOS & Android -->
<!-- iOS only features -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Short name">
<meta name="apple-mobile-web-app-status-bar-style" content="default"> <!-- possible values: default, black, black-translucent -->
<!-- Android only features -->
<meta name="viewport" content="target-densitydpi=device-dpi"> <!-- Android only before 4.4, possible values: device-dpi, high-dpi, medium-dpi, low-dpi -->
@plugnburn
plugnburn / dclock.sh
Created April 30, 2016 19:40
DClock: statusbar widget for DWM
#!/bin/bash
while true; do
loadAvg=$(cat /proc/loadavg | cut -d ' ' -f -4)
timeStr=$(date '+%a %b %d %H:%M:%S')
memAvail=$(grep -Po 'MemAvailable.*\d+' /proc/meminfo|cut -d ':' -f 2)
memTotal=$(grep -Po 'MemTotal.*\d+' /proc/meminfo|cut -d ':' -f 2)
memBusy=$(( $memTotal - $memAvail ))
xsetroot -name "RAM: $(( 100 * memBusy / memTotal ))% | CPU: $loadAvg | $timeStr"
sleep 1
done
@plugnburn
plugnburn / game.js
Last active June 14, 2016 09:02
Arc Escape: Super Hexagon for the very poor, see complete compressed game at http://arc-escape.surge.sh
function T() {
var track = 'w=t>>9,k=32,m=2048,a=1-((t/m)%1),d=(((14*t*t)^t)%m)*a,y=([3,3,4.7,2][p=w/k&3])*(t/4),h=((("IQNNNN!!]]!Q!IW]WQNN??!!W]WQNNN?".charCodeAt(w/2&15|p/3<<4))/33)*t)-t,s=y*.98%80+y%80+(w>>7&&a*((5*t%m*a&128)*(0x53232323>>w/4&1)+(d&127)*(0xa444c444>>w/4&1)*1.5+(d*w&1)+(h%k+h*1.99%k+h*.49%k+h*.97%k-64)*(4-(2*a)))),(s*s>>14?127:s)+128',
duration = 120,
beat=function(b,e,a,t){return(a="data")+":audio/wav;base64,UklGRl9fX19XQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgA"+btoa(eval("for(t=0;++t<e*8e3;)a+=String.fromCharCode(255&("+b+"))"))}
return beat(track, duration)
}
!function() {
var rAF = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.mozRequestAnimationFrame,
aud, screenHeight = 0, screenWidth = 0, minSide = 0, maxSide = 0, centerX = 0, centerY = 0, realLoop = null, score = 0, baseSpeed = 0, speed = 0,
@plugnburn
plugnburn / stego.js
Created March 29, 2016 19:38
PNG steganography in less than a kilo minified
//PNG steganography utils
//ratio: about 2 pixels per 1 byte of text message
//Auto EOD byte as 255
//Use only non-transparent images as the algo has to modify alpha-channel of affected pixels
//to protect RGB values from in-browser rounding
+function(w) {
var bitMapping = [0, 1, 2, 4, 5, 6, 8, 9], img = new Image(), cnv = document.createElement('canvas'), ctx=cnv.getContext('2d')
w.Stego = {
hide: function(imglink, msg, cb) { //image data URI (not only PNG) and message as input, resulting PNG image data URI as output (to callback)
@plugnburn
plugnburn / fm2toavi.sh
Created June 30, 2016 19:12
FM2toAVI: convert FCEUX emulator recordings into real videos
#!/bin/bash
# Usage: fm2toavi.sh rom.nes movie.fm2 output.avi
fceux --subtitles 0 --slstart 0 --slend 239 --xscale 1 --yscale 1 --special 0 --pal 0 \
--sound 1 --soundq 1 --soundrate 48000 --volume 150 --trianglevol 256 --square1vol 256 \
--square2vol 256 --noisevol 256 --pcmvol 256 --mute 1 --nospritelim 1 --no-config 1 \
--videolog "ffmpeg -f s16le -ar 48000 -channels 1 -i s.log -f rawvideo -r 60.0998 -s 256x224 -pix_fmt bgr24 -i - -c:a pcm_s16le -c:v libx264rgb -qp 0 -pix_fmt rgb24 $3"\
--playmov "$2" "$1"
@plugnburn
plugnburn / README.md
Last active July 7, 2016 19:45
Z5: a nano-library bundle for client-side development

Z5

Move all your frontend development to real programming with Z5 nano-library bundle that contains:

  • Zen.js (v2) for reactive in-memory storage;
  • Q.js for DOM manipulation;
  • R.js for client-side routing;
  • XT.js for dynamic DOM construction/templating;
  • XS.js for dynamic stylesheet construction.
@plugnburn
plugnburn / README.md
Last active October 16, 2016 03:23
XS.js - an ultra-small CSS rule builder in 10 lines of JS

XS.js

This is an ultra-small library for dynamic CSS rules construction (accompanying DOM construction library XT.js). 244 bytes minified, under 200 bytes gzipped.

How to obtain

Download it here or include it into your HTML:

@plugnburn
plugnburn / README.md
Last active March 12, 2017 15:13
Q.js - DOM nano-framework in 50 lines of JS

Q.js

Q.js is a very simple, tiny and elegant DOM manipulation library that provides the essentials in an original and minimalistic way.

How to obtain

Just download the minified version here or include it directly in your HTML:

@plugnburn
plugnburn / README.md
Last active March 12, 2017 15:15
R.js - parameterized client-side routing in 30 lines of JS

R.js

R.js is a 30-line JS library that brings life to the third part of minimalistic saga: parameterized client-side routing.

How to obtain

Download the library here or include the following into your HTML:

@plugnburn
plugnburn / 999.css
Last active March 16, 2017 00:05
999.css - a 999-byte barebones CSS framework
*{box-sizing:border-box;outline:none}
html {font-size:17px;font-family:Roboto,arial,sans-serif}
code,pre{
font-size:0.9rem;font-family:"Droid Sans Mono",monospace;
word-wrap:break-word;
}
body {margin:0;padding:0;font-size:1rem;line-height:1.375}
body,th,td,input,textarea,select,option,h1,h2,h3,h4,.fbox,.fr,.fr>*{
font-size-adjust:0.5;
font-family:inherit;