Skip to content

Instantly share code, notes, and snippets.

View katsos's full-sized avatar

Nikos Katsos katsos

View GitHub Profile
@katsos
katsos / main.css
Created December 13, 2019 16:01
Passe-partout main container style rules
main {
max-width: 38rem;
padding: 2rem;
margin: auto;
}
@katsos
katsos / k-grid.scss
Created October 31, 2019 16:08
My Flex+Scss Grid system
$gutter: 2rem;
%k-grid-row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
@mixin k-grid-col($cols, $container-cols: 10) {
@katsos
katsos / index.html
Last active October 20, 2019 12:40
Pure CSS Theming - https://jsbin.com/xezunec
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
:root {
--bg: white;
--color: grey;
@katsos
katsos / car.gr_check-all-makers.js
Last active July 15, 2019 20:20
Car.gr - check all makers
for (const d of Array.from(document.querySelectorAll('.makeslistli'))) {
d.querySelector('input').click()
}
@katsos
katsos / x_y.es6.js
Last active July 9, 2019 10:20
Swapping numbers without a temporary variable
// According to the Python version of the answer, in JS es6+ you can do:
[x, y] = [y, x]
function toDo(num, cb) {
if (num > 5) cb(num*2);
}
todo(10, (numFromCb) => {
console.log(numFromCb);
});
function one(x) {
return x * 10;
}
function two(x, callback) {
return x + callback(10);
};
console.log(two(5, one))
@katsos
katsos / clear_dpkg.sh
Created October 17, 2017 12:46
After a halted apt process
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
@katsos
katsos / this_vs_proto.js
Created August 29, 2017 08:55
This.function vs prototype.function
var x = {
dummy() { console.log('this'); }
}
var y = function() {};
y.prototype.dummy = function() { console.log('proto'); }
x.dummy();
// y.dummy(); // "TypeError: y.dummy is not a function
@katsos
katsos / one-way-realtime.html
Created May 9, 2017 12:54
One-way binding realtime - pure javascript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<input id="input" type="text"/>
<span id="span"></span>