Skip to content

Instantly share code, notes, and snippets.

View jordinebot's full-sized avatar
👋
Hi! I'm Jordi.

Jordi Nebot jordinebot

👋
Hi! I'm Jordi.
View GitHub Profile
@jordinebot
jordinebot / keybase.md
Created November 11, 2016 15:21
Keybase's Github identity proof

Keybase proof

I hereby claim:

  • I am jordinebot on github.
  • I am jordinebot (https://keybase.io/jordinebot) on keybase.
  • I have a public key ASC3vgRoWagImYv9afncwCePx4SkcAnbzU-miwtNcQaZfgo

To claim this, I am signing this object:

@jordinebot
jordinebot / fan-set
Created December 15, 2016 07:51
iMac Fan speed controller
#!/bin/bash
# Set fan 1 to forced mode
smc -k "FS! " -w 0002
# Set fan 1 to required RPM (Use rpm2hex to get the value)
RPM="$(rpm2hex $1)"
smc -k F1Tg -w ${RPM:2:4}
echo "Fan 1 set to $RPM RPM"
@jordinebot
jordinebot / ajax.class.js
Created May 9, 2017 10:04
ES6 Ajax Class
/* https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState */
const UNSENT = 0,
OPENED = 1,
HEADERS_RECEIVED = 2,
LOADING = 3,
DONE = 4;
/* https://developer.mozilla.org/en-US/docs/Web/HTTP/Status */
const OK = 200;
@jordinebot
jordinebot / cassidoo-1-august-2022.js
Created August 3, 2022 08:50
Cassidoo's Interview question of the week
/*
* Given an integer n, count the total number of 1 digits appearing in all non-negative integers less than or equal to n.
*
* > numberOfOnes(14)
* > 7 // 1, 10, 11, 12, 13, 14
*
*/
function numberOfOnes(n) {
return [...Array(n + 1).keys()].reduce(