Skip to content

Instantly share code, notes, and snippets.

View josketres's full-sized avatar

Josue Zarzosa josketres

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active April 25, 2024 21:49
What forces layout/reflow. The comprehensive list.

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.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@joseluisq
joseluisq / terminal-git-branch-name.md
Last active April 20, 2024 02:26
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@ischenkodv
ischenkodv / RAFPlugin.js
Created February 28, 2015 20:24
Jasmine plugin to test functions with requestAnimationFrame.
/**
* Jasmine RequestAnimationFrame: a set of helpers for testing funcionality
* that uses requestAnimationFrame under the Jasmine BDD framework for JavaScript.
*/
;(function() {
var index = 0,
callbacks = {};
function MockRAF(global) {
# use vi mode
setw -g mode-keys vi
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
@johnjohndoe
johnjohndoe / android-sdk-setup.sh
Last active June 12, 2019 08:31
Creating symbolic links in Android SDK folder. After Android-Studio resp. IntelliJ will work with Maven and Gradle.
#!/bin/bash
# Author: Tobias Preuss
# Version: 2018-01-05
echo "Creating symbolic links in Android SDK folder"
echo "============================================="
echo
if [ -z "$ANDROID_HOME" ] ; then
@scrogson
scrogson / README.md
Last active November 14, 2017 13:06
Shell functions to aid in using hub(1) with GitHub Enterprise.

I recently started working at Blue Box and we use GitHub Enterprise (GHE) for all of our apps. I had gotten in the habit of using hub to improve my git workflow and was curious if I could use hub with GHE. I turned to the docs and sure enough, you can!

The docs tell you two ways of setting up hub to use GHE:

By default, hub will only work with repositories that have remotes which point to github.com. GitHub Enterprise hosts need to be whitelisted to configure hub to treat such remotes same as github.com:

$ git config --global --add hub.host my.git.org
@ElliotChong
ElliotChong / facebookPluginDirectives.coffee
Created October 9, 2012 05:45
Angular directives that will parse Facebook plugins added to the DOM after Facebook has been initialized
module = angular.module 'FacebookPluginDirectives', []
createDirective = (name) ->
module.directive name, ->
restrict: 'C'
link: (scope, element, attributes) ->
FB?.XFBML.parse(element.parent()[0])
createDirective pluginName for pluginName in ['fbActivity', 'fbComments', 'fbFacepile', 'fbLike', 'fbLikeBox', 'fbLiveStream', 'fbLoginButton', 'fbName', 'fbProfilePic', 'fbRecommendations']
@FlaviuSim
FlaviuSim / .tmux.conf
Created June 24, 2012 13:43
Flaviu Simihaian's Tmux Conf
# use vi mode
setw -g mode-keys vi
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
@viktorklang
viktorklang / CQRS_ES_Actor.scala
Created February 1, 2011 15:05
CQRS and EventSourcing using Akka Actors
import scala.collection.mutable.ListBuffer
import akka.actor.{Actor,ActorRef}
import akka.actor.Actor._
import akka.routing.{ Listeners, Listen }
//Represents a domain event
trait Event
//A builder to create domain entities
trait EntityBuilder[Entity] {