Skip to content

Instantly share code, notes, and snippets.

🙉

Stefan Judis stefanjudis

🙉
Block or report user

Report or block stefanjudis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stefanjudis
stefanjudis / importJSON.gs
Created Jan 15, 2020
API data in google sheets
View importJSON.gs
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
View years.js
Object.entries({ 1985: "foo", 1984: "bar", 1987: "baz" })
.reverse()
.forEach(([year, content]) => console.log(year, content));
View smart-spread.js
const CPU = {
ram: '32gb',
ssd: '64gb',
micro: 'i7'
};
const { ssd, ...newCPU } = CPU;
console.log(newCPU);
// Object { ram: "32gb", micro: "i7" }
View switch.js
const actionType = "LUNCH_ORDERED"
switch(actionType) {
case "LUNCH_ORDERED":
console.log("lunch")
case "DINNER_ORDERED":
console.log("dinner")
break
default:
console.log(":/")
@stefanjudis
stefanjudis / keys.md
Last active Aug 7, 2019
Stefan Learns Emacs
View keys.md
ctrl+/            - undo
ctrl+b            - Switch to buffer
ctrl+c            - special command to invoke "stuff"
ctrl+c ctrl+e     - open Export Dispatcher
ctrl+c ctrl+s     - schedule todo
ctrl+c ctrl+'     - open buffer with code block
ctrl+x LEFT       - switch to prev buffer
ctrl+x RIGHT      - switch to next buffer
ctrl+x ctrl+e     - evaluate line
@stefanjudis
stefanjudis / README.md
Last active Aug 6, 2019
Twilio CLI snippets
View README.md

Useful Twilio CLI snippets. :)

@stefanjudis
stefanjudis / console.js
Last active Jul 31, 2019
Suprising replacement patterns in String.prototype.replace
View console.js
const msg = 'This is a great message';
msg.replace('great', 'wonderful');
// "This is a wonderful message"
//
// -> 'great' is replaced by 'wonderful'
msg.replace('great', '$&-$&');
// "This is a great-great message"
// '$&' represents the matched substring
@stefanjudis
stefanjudis / script.sh
Created Jul 29, 2019
create-dirs-recursively.sh
View script.sh
mkdir -p new-dir/{foo,baz}/whatever-{1,2}/{a,b};
exa --tree new-dir;
# new-dir
# ├── baz
# │ ├── whatever-1
# │ │ ├── a
# │ │ └── b
# │ └── whatever-2
View importjson.js
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@stefanjudis
stefanjudis / index.html
Last active Jul 17, 2019
Tweet for image preload
View index.html
<link rel="preload" as="image" href="640.png"
imagesrcset="640.png 640w, 800.png 800w, 1024.png 1024w"
imagesizes="100vw">
<!-- preload the correct image for the following element -->
<img src="640.png"
srcset="640.png 640w, 800.png 800w, 1024.png 1024w"
sizes="100vw">
You can’t perform that action at this time.