Skip to content

Instantly share code, notes, and snippets.

@grisevg
grisevg / Easings.hx
Created April 21, 2015 20:09
Easings.hx
package;
class Easings
{
//Standard easing functions
public static inline function easeInQuad(t:Float):Float { return t*t }
public static inline function easeOutQuad(t:Float):Float { return t*(2-t) }
public static inline function easeInOutQuad(t:Float):Float { return t<.5 ? 2*t*t : -1+(4-2*t)*t }
public static inline function easeInCubic(t:Float):Float { return t*t*t }
public static inline function easeOutCubic(t:Float):Float { return (--t)*t*t+1 }
@grisevg
grisevg / BezierEasing.hx
Last active August 29, 2015 14:19
BezierEasing.hx
package;
import haxe.ds.Vector;
/**
* BezierEasing - use 2d bezier curve to describe easing function. Follows specification of CSS3 `cubic-bezier`
* You can easily get desired values in the cubic-bezier editor: http://cubic-bezier.com/
* Implementation article - http://greweb.me/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/
* The algorithm uses combination of newton and bisection methods (http://en.wikipedia.org/wiki/Brent%27s_method#Dekker.27s_method)
* to approximate bezier function. Please note that this method is much more slower than direct easing functions.
class Collection {
var arr:Array<Int>;
var i:Int = 0;
public function new(arr:Array<Int>) {
this.arr = arr;
}
public var current(get, set):Int;
function get_current():Int { return arr[i]; }
@grisevg
grisevg / .tigrc
Last active August 29, 2015 14:22
My babun
set mouse = yes
@grisevg
grisevg / readline.md
Created June 2, 2015 20:32
Shortcuts

URL: http://www.bigsmoke.us/readline/shortcuts

  • Ctrl-A: go to the beginning of line,
  • Ctrl-E: go to the end of line,
  • Alt-B: skip one work backward,
  • Alt-F: skip one word forward,
  • Ctrl-U: delete to the beginning of line,
  • Ctrl-K: delete to the end of line,
  • Alt-D: delete to the end of word.
  • Ctrl-r: Incrementally search the line history ⇧ backwardly
@grisevg
grisevg / .tmux.conf
Created September 19, 2015 23:26
Babun setup
# More examples https://github.com/tangledhelix/dotfiles/blob/master/tmux.conf
###########################################################################
# Custom
# Allow to use vim navigation keys (hjkl) in tmux scroll mode
setw -g mode-keys vi
# Hack to let term window controll scrolling. Will override `set -g mode-mouse on`
# set -g terminal-overrides 'xterm*:smcup@:rmcup@'
INSERT INTO `amx_bans` (`player_ip`, `player_id`, `player_nick`, `admin_ip`, `admin_id`, `admin_nick`, `ban_type`, `ban_reason`, `ban_created`, `ban_length`, `server_ip`, `server_name`) VALUES
('', '', '', NULL, 'admin', 'admin', 'SI', 'autocheat', UNIX_TIMESTAMP(), 0, null, 'website');
@grisevg
grisevg / FlowBlockList.hx
Last active June 15, 2016 23:41
FlowBlockList.hx
package ;
import List;
import tink.core.Noise;
import tink.core.Signal;
import tink.core.SignalTrigger;
using Lambda;
typedef Flow = Void -> Void;
#include <avr/interrupt.h>
#include <avr/power.h>
#include <avr/io.h>
#include <WaveHC.h>
#include <WaveUtil.h>
WaveHC wave; // This is the only wave (audio) object, -- we only play one at a time
#define error(msg) error_P(PSTR(msg)) // Macro allows error messages in flash memory
// 'Cyber falls' sketch, adapted from code for Firewalker sneakers.
// Creates a fiery rain-like effect on multiple NeoPixel strips.
// Requires Adafruit Trinket and NeoPixel strips. Strip length is
// inherently limited by Trinket RAM and processing power; this is
// written for five 15-pixel strands, which are paired up per pin
// for ten 15-pixel strips total.
#include <Adafruit_NeoPixel.h>
#include <avr/interrupt.h>