Skip to content

Instantly share code, notes, and snippets.

View petrstepanov's full-sized avatar
🏠
Working from home

Petr Stepanov petrstepanov

🏠
Working from home
View GitHub Profile
@LionsAd
LionsAd / Lazy-Load-Scripts-In-Order.md
Last active July 4, 2022 16:40
Lazy Load Javascript in Order

Introduction

Lazy loading scripts is a very good idea, because Javascript should be a progressive enhancement and not mandatory.

I know that's old school, but I still believe in that vision of the Web.

Jake Archibald tried this in 2013 (https://www.html5rocks.com/en/tutorials/speed/script-loading/) and kinda resigned "That. At the end of the body element.".

Much has changed since then and the programmatic way of loading the scripts as async works now. (https://www.html5rocks.com/en/tutorials/speed/script-loading/#toc-dom-rescue):

@roadrunner2
roadrunner2 / 0 Linux-On-MBP-Late-2016.md
Last active February 29, 2024 16:29
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

Introduction

This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se

@dw72
dw72 / genicons.sh
Created November 27, 2016 14:40
Generate and install png icons from svg file
#!/usr/bin/bash
src=$1
dst=${1%.*}.png
[[ -z "$2" ]] && type="apps" || type=$2
for i in 16 22 24 32 64 128
do
inkscape -z -e $dst -w $i -h $i $src
@githubutilities
githubutilities / ntfs-mac.md
Last active December 13, 2023 02:04
NTFS in Mac
@learncodeacademy
learncodeacademy / pubsub.js
Created July 29, 2015 02:54
Basic Javascript PubSub Pattern
//events - a super-basic Javascript (publish subscribe) pattern
var events = {
events: {},
on: function (eventName, fn) {
this.events[eventName] = this.events[eventName] || [];
this.events[eventName].push(fn);
},
off: function(eventName, fn) {
if (this.events[eventName]) {
@cvergne
cvergne / stringUtils.js
Last active March 3, 2022 20:43
Little javascript method to get initials from a name
String.prototype.getInitials = function(glue){
if (typeof glue == "undefined") {
var glue = true;
}
var initials = this.replace(/[^a-zA-Z- ]/g, "").match(/\b\w/g);
if (glue) {
return initials.join('');
}
@pazdera
pazdera / gist:1098119
Created July 21, 2011 20:25
Singleton example in C++
/*
* Example of a singleton design pattern.
* Copyright (C) 2011 Radek Pazdera
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,