Skip to content

Instantly share code, notes, and snippets.

View fitsum's full-sized avatar
💭
npx fitsum

ፍፁም fitsum

💭
npx fitsum
View GitHub Profile
@fitsum
fitsum / mouse-trace.js
Created February 7, 2020 18:42
getting mousemove direction for custom cursor
//TODO: add cursor bg and rotate script. can't tell what's happening without visual
let lastCoords = [];
const handleDir = e => {
let xDiff, yDiff, currCoords = [e.x, e.y];
if ( lastCoords.length !== 0 ){
xDiff = currCoords[0] - lastCoords[0];
yDiff = currCoords[1] - lastCoords[1];
}
@fitsum
fitsum / dumb-console-animation.js
Last active April 26, 2024 05:25
dumb console animation
var angle = null,
step = 20,
rate = 90;
draw = () => {
if (!angle) {
angle = 0;
}
console.clear();
@fitsum
fitsum / ticker.js
Last active April 26, 2024 05:26
request animation frame
var now, dt,
rate = 0.5,
last = performance.now();
function frame() {
now = performance.now();
dt = (now - last) / 1000; // duration in seconds
if(dt >= rate){
console.log("bing")
last = now;
@fitsum
fitsum / bells-sotto.rb
Created December 10, 2017 18:05
functions in sonic pi
# Welcome to Sonic Pi v2.10
A = :A
B = :B
C = :C
D = :D
G = :G
mainPattern = [
[B, 0],
@fitsum
fitsum / findInArray.js
Last active April 26, 2024 05:10
find in array
f = function(needle,haystack,collect){
collection = [];
haystack.filter(function(item){
if(typeof item === "string" && item.match(needle)!== null)
collect += item;
})
return collect;
}
bison || flacc
flex
qt5-default
libgtk-3-dev
libpcap0.8-dev
@fitsum
fitsum / if(array.indexOf(someObj) === -1) {add} else {next}
Last active April 26, 2024 05:02
check if obj exists in array then add if not
var source = [{name: "Fitsum", race: "blk"},{name: "Alice", race: "wht"},{name: "Jen", race: "wht"},{name: "Kim", race: "blk"},{name: "Lee", race: "asn"}],
target = [];
function userExists(name, idx, oldArr) {
return target.some(function(el) {
return el.name === name;
});
}
function addUser(name, idx, newArr) {
@fitsum
fitsum / gitscripts
Last active April 26, 2024 05:11
🙏🔧 so far just the one
# more to come
#!/bin/bash
#!/bin/bash
function reba(){
#first arg is rebase branch
count=1
for branch in "$@"
do
@fitsum
fitsum / git lgs
Created June 8, 2015 22:27
pretty git logs
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
@fitsum
fitsum / app boiler
Created February 27, 2015 22:06
app boiler
APP BOILER
Entry Points
Time
check local storage (last || total visit(s)),
check server/appstorage (last || total visit(s))
check TOD
check DOW (work/school)
check MOY (season general, available activities)