Skip to content

Instantly share code, notes, and snippets.

@robertocarroll
robertocarroll / script.js
Created October 20, 2021 08:20
Difference between parameters and arguments
// The parameters are the aliases for the values that will be passed to the function. The arguments are the actual values.
var foo = function( a, b, c ) {}; // a, b, and c are the parameters when declaring the function
foo( 1, 2, 3 ); // 1, 2, and 3 are the arguments when we pass in when we call the function
@robertocarroll
robertocarroll / script.js
Created October 15, 2021 12:32
Using object destructuring to make cleaner and better functions
// https://gomakethings.com/destructuring-function-parameters-with-vanilla-js-for-better-developer-ergonomics/
// use curly brackets inside the function arguments and then set defaults inside
function greet ({greeting, name, time = 'today'}) {
return `${greeting} ${name}! How are you ${time}?`;
}
// returns "Hello George! How are you today?"
//https://gist.github.com/jogilvyt/22f1628d4c2853df1113f8e28096fde0
function getTranslationMap(rhyme) {
const rhymes = {
"apples and pears": "Stairs",
"hampstead heath": "Teeth",
"loaf of bread": "Head",
"pork pies": "Lies",
"whistle and flute": "Suit",
};
@robertocarroll
robertocarroll / convertSeconds.js
Created October 14, 2021 12:47
Convert seconds to minutes and seconds
function secondsToTime(e){
var h = Math.floor(e / 3600).toString().padStart(2,'0'),
m = Math.floor(e % 3600 / 60).toString().padStart(2,'0'),
s = Math.floor(e % 60).toString().padStart(2,'0');
return h + ':' + m + ':' + s;
//return `${h}:${m}:${s}`;
}
console.log(secondsToTime(7735)); //02:08:55
@robertocarroll
robertocarroll / .html
Created February 6, 2019 14:28
Conference tracks
<div class="row">
<div class="col-lg-9">
<nav>
<p aria-hidden="true" class="d-inline-block h5 text-uppercase mr-1">Days</p>
<ul class="d-inline-block list-inline list-inline-borders">
<li class="list-inline-item h3">
<a href="#d20190823"><span class="sr-only">Day</span> 1</a>
</li>
<li class="list-inline-item h3">
tmpdir=tmp
if [ -d "$tmpdir" ]; then
rm -rf $tmpdir
fi
mkdir $tmpdir
height=2592
width=10
n=0
for f in *.jpg
do

Source: Institute for Professional Excellence in Coaching

Powerful questions are open-ended, clarity seeking, probing, challenging, thought-provoking, future directed, solution oriented questions that cause a person to search for answers and new possibilities.

  • What can you do about this?
  • What about that makes it work?
  • What other choices can you make?
  • What’s another way to look at that?
  • How can you reframe that to help you move on?
  • What’s your next step?
@robertocarroll
robertocarroll / gist:e87a5eb1a29f605940840858f0966129
Created December 14, 2017 17:31
Centre image in a div with flexbox
http://jsfiddle.net/danield770/Ld8bcc0p/1/
div.do_not_define_height {
display: flex;
justify-content: center;
/* align horizontal */
align-items: center;
/* align vertical */
width: 100%;
height: 100%;
// Put this in _layouts - https://github.com/j-greig/greig/blob/main/_layouts/post.html
{% include style_snippets.html %}
{{ content | replace : h2, h2_styled | replace : h3, h3_styled | replace : pstring, pstring_styled | replace : blockquote, blockquote_styled | replace : cite, cite_styled | replace : ol, ol_styled | replace : ul, ul_styled | replace : list_item_, list_item_styled
}}
shadow on box
.scroll-story-banner::after {
content: "";
position: absolute;
top: 100%;
left: 15px;
right: 15px;
width: auto;
height: 15px;