Skip to content

Instantly share code, notes, and snippets.

Lin Kassem Sara LinKassem

Block or report user

Report or block LinKassem

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View loadPresets.js
const webpackMerge = require("webpack-merge");
const applyPresets = (env = { presets: [] }) => {
const presets = env.presets || [];
/** @type {string[]} */
const mergedPresets = [].concat(...[presets]);
const mergedConfigs = mergedPresets.map(presetName => require(`./presets/webpack.${presetName}`)(env));
return webpackMerge({}, ...mergedConfigs);
};
@paulirish
paulirish / what-forces-layout.md
Last active Nov 17, 2019
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@ericandrewlewis
ericandrewlewis / index.md
Last active Nov 12, 2019
C++ Pointer Tutorial
View index.md

C++ Pointer Tutorial

Because pointers can be ugh

"Regular" variables (not pointers)

To understand a pointer, let's review "regular" variables first. If you're familiar with a programming language without pointers like JavaScript, this is what you think when you hear "variable".

When declaring a variable by identifier (or name), the variable is synonymous with its value.

@wayspurrchen
wayspurrchen / gist:b6fd4eb085edf54406b7
Last active Apr 27, 2019
Web Performance Optimization Techniques
View gist:b6fd4eb085edf54406b7
@lttlrck
lttlrck / gist:9628955
Created Mar 18, 2014
rename git branch locally and remotely
View gist:9628955
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@ocean90
ocean90 / box-shadow.html
Last active Nov 7, 2019
CSS3 Box Shadow, only top/right/bottom/left and all
View box-shadow.html
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
View git-cheat-sheet.md

Setup

git clone <repo>

clone the repository specified by ; this is similar to "checkout" in some other version control systems such as Subversion and CVS

Add colors to your ~/.gitconfig file:

@paulirish
paulirish / zIndex-bookmarklet.js
Created Oct 15, 2009
find all elements with a z-index and indicate what they are.
View zIndex-bookmarklet.js
// find all elements with a z-index and indicate what they are.
// uses css outline which is not supported in IE <8
function contrast(color){ return '#' +
(Number('0x'+color.substr(1)).toString(10) > 0xffffff/2 ? '000000' : 'ffffff');
}
jQuery('*')
.filter(function(){ return $(this).css('zIndex') !== 'auto'; })
.each(function(){
@hallettj
hallettj / global-variables-are-bad.js
Created Feb 14, 2009
How and why to avoid global variables in JavaScript
View global-variables-are-bad.js
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
You can’t perform that action at this time.