Skip to content

Instantly share code, notes, and snippets.

View mikekasprzak's full-sized avatar
🐢
I'm slow to respond.

Mike Kasprzak mikekasprzak

🐢
I'm slow to respond.
View GitHub Profile
@addyosmani
addyosmani / preprocessing.md
Last active May 29, 2024 01:24
JavaScript preprocessing/precompilation

Problem: How can we preprocess JavaScript (at build-time or on the server-side) so engines like V8 don't have to spend as much time in Parse? This is a topic that involves generating either bytecode or a bytecode-like-abstraction that an engine would need to accept. For folks that don't know, modern web apps typically spend a lot longer in Parsing & Compiling JS than you may think.

  • Yoav: This can particularly be an issue on mobile. Same files getting parsed all the time for users. Theoretically if we moved the parsing work to the server-side, we would have to worry about it less.
  • One angle to this problem is we all ship too much JavaScript. That's one perspective. We could also look at preprocessing.
  • We've been talking about this topic over the last few weeks a bit with V8. There were three main options proposed.
    1. Similar to what optimize-js does. Identify IIFEs and mark them as such so the browser and VMs heuristics will catch them and do a better job than today. optimize-js only tackles IIFE bu
@NocturnDragon
NocturnDragon / Swizzles.h
Last active October 15, 2023 01:20
Swizzles in Clang, GCC, and Visual c++
#include <stdio.h>
// #define CLANG_EXTENSION
// Clang compile with -O3
#define VS_EXTENSION
// https://godbolt.org/z/sVWrF4
// Clang compile with -O3 -fms-compatibility
// VS2017 compile with /O3
@flyinprogrammer
flyinprogrammer / clean.sh
Created December 22, 2014 04:15
Ubuntu vagrant cleanup script
#!/bin/bash
# Unmount project
umount /vagrant
# Tell installer to keep en_US
echo en_US > /etc/locale.gen
# Install localepurge - NO dpkg
apt-get install -y localepurge
localepurge
apt-get remove -y pollinate overlayroot fonts-ubuntu-font-family-console cloud-init python-apport landscape-client juju chef open-vm-tools localepurge
@kmichel
kmichel / dot.cpp
Created January 26, 2014 21:57
Ugly custom operator
#include <iostream>
class DotOp {
};
class LhsDotOp {
public:
int value;
explicit LhsDotOp(int value) : value(value) {}
@ssokolow
ssokolow / install.sh
Last active April 9, 2019 20:31
Simple XDG Install Script for Linux Games
#!/bin/sh
#
# Simple XDG Install Script for Linux Games
#
# Features:
# - Communicates with the desktop via the xdg-utils vendor integration scripts.
# (No need to upgrade if the implementation details change.)
# - Icons are resolved via the desktop theming system, granting theme
# developers the ability to provide customized versions which preserve the
# overall system aesthetic.
@adamloving
adamloving / temporary-email-address-domains
Last active May 31, 2024 15:43
A list of domains for disposable and temporary email addresses. Useful for filtering your email list to increase open rates (sending email to these domains likely will not be opened).
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@lambdaman2
lambdaman2 / Snipplr-25278.bash
Created October 1, 2012 12:48
Bash: use curl to share code/text from terminal
# weird way to represent \' // exit using ctrl-D
alias sharecode='curl -si -F '\''content=&lt;-'\'' http://dpaste.com/api/v1/ | grep ^Location: | colrm 1 10'
@ssokolow
ssokolow / get_troubleshooting_data.sh
Created September 21, 2012 00:41
Novice-safe shell script for gathering data to report bugs in Linux games
#!/bin/sh
# dash-Compatible Linux Configuration Dumper for Troubleshooting Games
# (Sort of like DxDiag but for Linux)
#
# Get and contribute updates to this script at: https://gist.github.com/3759156
#
# NOTE: Please test changes on as many of the following shells as possible:
# dash, bash, pdksh, busybox, ash, zsh
#
# TODO:
@jboner
jboner / latency.txt
Last active July 23, 2024 14:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD