Skip to content

Instantly share code, notes, and snippets.

@indianajone
indianajone / index.html
Created July 31, 2020 10:49
Rounded Triangle by css
<div class='triangle'></div>
@indianajone
indianajone / index.js
Created May 30, 2019 07:08
Code challenge: validate given string has contains all english alphabet
// Test if a string uses all letters of the English alphabet.
// "The quick brown fox jumps over the lazy dog."
// Complete a function that tests if a string uses all letters of the alphabet.
const alphabet = [
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
];
// Works but too complex
@indianajone
indianajone / find-and-kill-processes.md
Created May 8, 2019 04:40
Find (and kill) all processes listening on a port

To search for processes that listen on a specific port use the lsof or “List Open Files”. The -n argument makes the command run faster by preventing it from doing a ip to hostname conversion. Use grep to show only lines containing the word LISTEN.

lsof -n | grep LISTEN

To filter for a specific port use the following:

lsof -n -i4TCP:[PORT] | grep LISTEN

@indianajone
indianajone / jsonp.js
Created July 25, 2018 03:35
Useful jsonp method
function jsonp(url, callback) {
var callbackName = 'jsonp_callback_' + Math.round(100000 * Math.random());
window[callbackName] = function (data) {
delete window[callbackName];
document.body.removeChild(script);
callback(data);
};
var script = document.createElement('script');
script.src = url + (url.indexOf('?') >= 0 ? '&' : '?') + 'callback=' + callbackName;
@indianajone
indianajone / index.html
Last active April 27, 2017 16:08
Flexbox scrollable
<div class="container">
<div class="header">
<h3>Title</h3>
</div>
<div class="content">
<div class="scrollable">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam veritatis quae vel dolor optio nobis vitae, dolore quaerat nulla alias, tenetur perspiciatis porro saepe nostrum cum non quam ipsa recusandae.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam veritatis quae vel dolor optio nobis vitae, dolore quaerat nulla alias, tenetur perspiciatis porro saepe nostrum cum non quam ipsa recusandae.</p>
@indianajone
indianajone / checkbox.scss
Created March 21, 2017 18:10
Checkbox Component
checkbox {
box-sizing: border-box;
display: block;
margin-bottom: 16px;
white-space: nowrap;
cursor: pointer;
outline: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;