Skip to content

Instantly share code, notes, and snippets.

View tnottu's full-sized avatar

Tomi tnottu

  • Loihde Factor
  • Vantaa, Finland
View GitHub Profile
@EllyLoel
EllyLoel / reset.css
Last active April 13, 2024 18:14
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/open-props@1.3.16/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
@TeemuSuoranta
TeemuSuoranta / kunnat.php
Created March 8, 2017 14:55
Suomen kunnat maakunnittain 2017
<?php
$municipalities_by_region = array(
'Ahvenanmaa' => array(
35 => 'Brändö',
43 => 'Eckerö',
60 => 'Finström',
62 => 'Föglö',
65 => 'Geta',
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active May 22, 2024 07:37
Vanilla JavaScript Quick Reference / Cheatsheet
@jabranr
jabranr / Format Text String to Tweet with JavaScript String prototype.js
Last active April 24, 2023 10:53
Format Text String to Tweet with JavaScript String.prototype
// Enable IE8 support for indexOf
if ( typeof Array.prototype.indexOf === 'undefined' ) {
Array.prototype.indexOf = function(item) {
for (var i = 0; i < this.length; i++) {
if (this[i] === item) {
return i;
}
return -1;
}
}
@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active May 21, 2024 04:57
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: