Skip to content

Instantly share code, notes, and snippets.

@jocki84
jocki84 / README.md
Last active June 23, 2022 06:13 — forked from hsablonniere/README.md
scrollIntoViewIfNeeded 4 everyone!!!

Polyfill for scrollIntoViewIfNeeded()

This gist provides polyfill code for the [scrollIntoViewIfNeeded()][SIVIN] Element method found on WebKit browsers.

Features

There is no particular requirement on the position in the hierarchy of the

@yang-wei
yang-wei / note.md
Last active April 19, 2021 14:49
Vue.js tips and tricks

Notes: All the examples below are only tested on Vue.js 1.0 (above).

Notes: The examples below use ES6 so it's recommended to use browserify or webpack to easily integrate babel.

when or where can we use this.$el

When you need to access DOM attribute, be careful with the lifecycle. Vue.js has a few useful lifecycle hooks.

Let's say we want to scroll our component to the bottom (imagine it's a long list with overflow-y: auto) once it's instantiate.

@DmitrySoshnikov
DmitrySoshnikov / dfs-bfs-non-recursive.js
Created October 19, 2015 05:40
Non-recursive DFS and BFS algorithms
/**
* Depth-first and Breadth-first graph traversals.
*
* In this diff we implement non-recursive algorithms for DFS,
* and BFS maintaining an explicit stack and a queue.
*
* by Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
* MIT Style license
*/
@paulirish
paulirish / what-forces-layout.md
Last active May 17, 2024 18:01
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
@Maumagnaguagno
Maumagnaguagno / .travis.yml
Last active February 18, 2020 00:02
Make Travis-CI push files to other repositories for you when tests pass
language: ruby
rvm:
- 2.0.0
env:
global:
- USER="username"
- EMAIL="username@mail.com"
- REPO="name of target repo"
- FILES="README.md foo.txt bar.txt"
- GH_REPO="github.com/${USER}/${REPO}.git"
@WayneBuckhanan
WayneBuckhanan / Vagrantfile.OSX
Last active July 13, 2019 15:55
OSX Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# https://github.com/AndrewDryga/vagrant-box-osx
config.vm.box = "osx-yosemite"
@magnetikonline
magnetikonline / README.md
Last active March 14, 2024 13:29
NSSM - the Non-Sucking Service Manager cheatsheet.
@simontabor
simontabor / rebalanceRedis.js
Created February 19, 2015 14:53
Redis Cluster slot balancing
var async = require('async');
var Redis = require('redis');
/*
* Rebalance a Redis cluster
*
* 1. Keeps slot allocations in blocks to maintain tidy configuration.
* 2. Moves slots to the coldest node from the hottest node, so the cluster stays healthy whilst rebalancing (`liveBalance`)
*/
@andrealbinop
andrealbinop / setup-modernie-vagrant-boxes.md
Last active May 28, 2023 01:54
Setup modern.ie vagrant boxes

Setup modern.ie vagrant boxes

Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.

Pre-requisites

@C0deH4cker
C0deH4cker / macho_extractor.c
Last active November 2, 2023 14:47
Program that will extract a segment from a mach-o file. Should even work on Linux/BSD/UNIX?
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
/* For supporting Linux and other systems that don't have mach-o headers */