Skip to content

Instantly share code, notes, and snippets.

@ffigiel
ffigiel / game.rs
Created August 22, 2018 10:14
amethyst 0.9 image loader util
struct ImageLoader {
texture_id: u64,
}
impl ImageLoader {
fn new() -> ImageLoader {
ImageLoader {
texture_id: 0,
}
}
@ffigiel
ffigiel / example.js
Last active June 23, 2016 22:28
redux-no-bs
// in actionTypes.js
export const ADD = 'ADD'
// in actions.js
export const add = createAction(ADD)
export const addSquare = createAction(ADD, (x) => x * x)
// in reducers.js
export default createReducer(0, {
[ADD]: (state, payload) => state + payload,
@ffigiel
ffigiel / ubuntu.sh
Last active December 28, 2017 16:54
Simple script for managing a virtualbox machine
#!/usr/bin/env bash
VM_NAME='ubuntu'
VBoxManage () {
'/cygdrive/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' $@
}
IsVmRunning () {
@ffigiel
ffigiel / README.md
Last active August 29, 2015 13:56
Flexible svg sprites

Flexible svg sprites

I've been fiddling with svg sprites a bit today, trying to handle them in such way that you could use any unit you like to specify their size. Here's what I came up with.

(You could use this method for bitmap sprites as well, but I don't see much sense in this!)

Presumptions

All images in the sprite must share the same width or height, preferably both. Note that maintaining rules for images with several different aspect ratios may be problematic.

@ffigiel
ffigiel / sync.sh
Created February 27, 2014 15:33
lftp sync
#!/bin/bash
OLDSUM=0
echo "$(tput setaf 3)`date +"%T"`: loading...$(tput sgr0)";
while true ; do
sleep 1;
NEWSUM=`ls -laR | md5sum`
if [ "$OLDSUM" != "$NEWSUM" ] ; then
lftp YOUR_HOST -e 'mirror --use-cache --exclude-glob static/.sass-cache/ -R -v ~/YOUR_DIRECTORY /
bye';