Skip to content

Instantly share code, notes, and snippets.

View kdzwinel's full-sized avatar

Konrad Dzwinel kdzwinel

View GitHub Profile
@kentbrew
kentbrew / setMultiHeaders.js
Created January 10, 2011 22:57
Setting multiple cookies (or whatever) per header with Node. Bonus: p3p line prevents IE from spazzing out.
response.writeHead(200, {
'p3p': ['policyref="http://foo.com/p3p.xml"', 'CP="OOO EEE OOH AH AHH"'],
'Set-Cookie': ['ting="tang; expires=0; path=/;"', 'wallawalla="bingbang; expires=123456789; path=/;"'],
'Content-Type': 'text/html'
});
@gre
gre / easing.js
Last active April 23, 2024 04:20
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@badsyntax
badsyntax / find-unused-sass-variables.sh
Last active November 24, 2021 09:59 — forked from axelerator/Find unused variables in sass files
Find unused SCSS variables. Usage: `./find-unused-sass-variables.sh sassDir/`
#!/usr/bin/env bash
#
# Approach:
# 1. Find variable declaration in the form of "$my-var: anyvalue"
# 2. Loop through found variables and find occurrences of each variable in all sass files
# 3. Filter out vars that occurred only once
if [ -z "$1" ]; then
echo "Please specify a directory as the first argument."
exit 1
@corburn
corburn / index.html
Last active February 25, 2024 16:25
Minimal HTML5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
@kris-ellery
kris-ellery / JS-error-tracking-with-GA.js
Last active November 18, 2021 19:00
Track JavaScript errors using Universal Analytics from Google.
/**
* Track JS error details in Universal Analytics
*/
function trackJavaScriptError(e) {
var errMsg = e.message;
var errSrc = e.filename + ': ' + e.lineno;
ga('send', 'event', 'JavaScript Error', errMsg, errSrc, { 'nonInteraction': 1 });
}
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 20, 2024 16:52
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@jaredwilli
jaredwilli / gist:c60e5f61a53af76b52ca
Last active February 11, 2020 17:45
Angular 2.0 questions answered by the Angular team
What is the release date for 2.0?
No exact release date yet. They don't want what happened with 1.2.They want to
make sure they get it done right for 2.0 so they are not setting a date yet.
What is the plan for having a migration path for 2.0? How much rewriting of 1.x
apps will need to be done to migrate to 2.0?
Mishko said that there will definitely be a migration plan for 2.0. They dont know
@paulirish
paulirish / args.gn
Last active October 22, 2023 12:25
How to build Chromium to hack on DevTools
# Build arguments for the gn build
# You can set these with `gn args out/Default`
# ( and they're stored in src/out/Default/args.gn )
# See "gn args out/Default --list" for available build arguments
# component build, because people love it
is_component_build = true
# release build, because its faster
is_debug = true
@jodyheavener
jodyheavener / Import SVG.sketchplugin
Last active February 11, 2020 17:44
Import a desired SVG in to a Sketch canvas
// Import Ale's fantastic Sketch Sandbox
// https://github.com/bomberstudios/sketch-sandbox
#import 'sketch-sandbox.js'
// Are we on a page or an artboard?
var page = doc.currentPage();
var canvas = page.currentArtboard() ? page.currentArtboard() : page;
// Define the location of the file you want to import, using file:// protocol
var fileURL = NSURL.URLWithString("file:///Users/johndoe/Downloads/my_cat.svg");
@paulirish
paulirish / readme.md
Last active April 2, 2024 20:18
resolving the proper location and line number through a console.log wrapper

console.log wrap resolving for your wrapped console logs

I've heard this before:

What I really get frustrated by is that I cannot wrap console.* and preserve line numbers

We enabled this in Chrome DevTools via blackboxing a bit ago.

If you blackbox the script file the contains the console log wrapper, the script location shown in the console will be corrected to the original source file and line number. Click, and the full source is looking longingly into your eyes.