Skip to content

Instantly share code, notes, and snippets.

Avatar
🟨
create not consume

Chris Sev chris-sev

🟨
create not consume
View GitHub Profile
@chris-sev
chris-sev / function.sh
Created May 25, 2021 — forked from jldeen/function.sh
toggle mac menu bar
View function.sh
function toggleMenu () {
~/.dotfiles/bin/toggleMenuBigSur.sh
}
View setup.sh
# how to run this thingy
# create a file on your mac called setup.sh
# run it from terminal with: sh setup.sh
# heavily inspired by https://twitter.com/damcclean
# https://github.com/damcclean/dotfiles/blob/master/install.sh
#!/bin/bash
set -euo pipefail
View array-is-array-check.js
const names = ['Pete', 'John', 'Mary'];
const isArray = Array.isArray(names);
console.log(isArray); // true
View array-is-array.js
console.log(Array.isArray('one')); // false
console.log(Array.isArray(['thing1', 'thing2'])); // true
View array-find-less-than-50.js
const numbers = [60, 32, 55, 22, 10];
const lessThan50 = numbers.find(number => number < 50 );
console.log(lessThan50);
// output: 32
@chris-sev
chris-sev / array-find-object.js
Created Dec 21, 2018
find() in array of objects
View array-find-object.js
const people = [
{ name: 'chris', username: 'chrisoncode' },
{ name: 'nick', username: 'whatnicktweets' },
{ name: 'holly', username: 'hollylawly' },
];
people.find(person => person.name === 'holly');
// output: { name: 'holly', username: 'hollylawly' }
View array-find.js
const people = ['chris', 'nick', 'holly'];
// find chris
const singlePerson = people.find(name => name === 'chris');
console.log(singlePerson);
// output: chris
View array-concat.js
const months = ['March', 'April', 'May'];
const otherMonths = ['June', 'July'];
const totalMonths = months.concat(otherMonths);
console.log(totalMonths);
View array-concat-quick.js
// we have 2 arrays of people
const people = ['chris', 'nick'];
const newPeople = ['holly', 'william'];
// add them together to create a new array
const allPeople = people.concat(newPeople);
// output: ['chris', 'nick', 'holly', 'william']
console.log(allPeople);
@chris-sev
chris-sev / instructions.md
Created Dec 11, 2018
Scotch.io Public Posts API
View instructions.md

The Scotch.io public API sits at:

https://scotch.io/api/f/posts

You can filter, sort, and include relationships using query params. There's more docs below but the URL you'll most likely use is:

https://scotch.io/api/f/posts?sort=-published_at&include=author,stats,tags,category