Skip to content

Instantly share code, notes, and snippets.

@stevenocchipinti
stevenocchipinti / promises.js
Created October 13, 2023 03:54
Sequential promises
// https://jrsinclair.com/articles/2019/how-to-run-async-js-in-parallel-or-sequential/
const job = (name, delay) =>
new Promise((res) => {
setTimeout(() => {
console.log(`Job(${name}) resolving after ${delay}`);
res();
}, delay);
});
@stevenocchipinti
stevenocchipinti / curses.rb
Created June 4, 2013 03:29
Simple example of using Curses (built in to the ruby stdlib)
#!/usr/local/bin/ruby
require "curses"
include Curses
begin
init_screen
crmode
x = 0
y = 0
@stevenocchipinti
stevenocchipinti / README.md
Last active September 27, 2022 05:31
Play a random song when a GPIO button is pressed

Play a random song when a GPIO button is pressed

Dependencies for python

sudo pip3 install python-vlc
sudo apt-get install python3-rpi.gpio

Or for python2

@stevenocchipinti
stevenocchipinti / remote.xml
Created April 4, 2015 11:37
Kodi remote debugging keymap
<!--
kindly provided by 'Knapster'
Ref: http://forum.kodi.tv/showthread.php?tid=139145&pid=1285390#pid1285390
-->
<keymap>
<global>
<remote>
<channelplus>Notification(Keypress, channelplus, 1)</channelplus>
<channelminus>Notification(Keypress, channelminus, 1)</channelminus>
@stevenocchipinti
stevenocchipinti / Person.js
Last active July 22, 2021 07:47
A simple demonstration of classes in es6
//
// Person.js
//
// This is a simple Person class.
//
// It doesn't do much, but it demonstrates the use of ES6 classes. Note that
// this code will most likely not work in old browsers directly. To 'compile'
// this down to the more widely accepted ES5, you could use Babel.
//
@stevenocchipinti
stevenocchipinti / hover.js
Created January 30, 2019 23:47
Generate a 20% brighter color for hover
// https://gist.github.com/mjackson/5311256
// http://xahlee.info/js/js_convert_decimal_hexadecimal.html
/**
* Converts an RGB color value to HSV. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSV_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and v in the set [0, 1].
*
* @param Number r The red color value
@stevenocchipinti
stevenocchipinti / README.md
Last active October 19, 2018 01:40
An interactive version of `yarn run` for fish shell

yarnrun

An interactive version of yarn run for fish shell

Dependencies

Requires my pecorb gem (or an alternative)

gem install pecorb
@stevenocchipinti
stevenocchipinti / readme.md
Created September 4, 2018 07:33
A `serve-live` command for fish

serve-live

A live reload server command for fish

Installation

yarn global add browser-sync
@stevenocchipinti
stevenocchipinti / JavaScriptFundamentals.md
Last active July 30, 2018 01:58
JavaScript Fundamentals

JavaScript Crash Course

A list of things to learn / talk about in order to learn the fundamentals of JavaScript and modern tools for dev

History

# https://www.youtube.com/watch?v=Ct6BUPvE2sM
def ouhh(left, right)
if left == "pen" && right == "apple"
"apple-pen"
elsif left == "pen" && right == "pineapple"
return "pineapple-pen"
elsif left == "apple-pen" && right == "pineapple-pen"
return "pen-pineapple-apple-pen"
end