Skip to content

Instantly share code, notes, and snippets.

View Yukaii's full-sized avatar
👾
nyan, nyan, nyan

Yukai Huang Yukaii

👾
nyan, nyan, nyan
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active April 19, 2025 04:59
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

You can trigger a GitHub Pages (Jekyll) rebuild with a single API call. This is pretty useful for auto-publishing blog posts from a bot like Zapier in conjunction with future: false in your Jekyll config.yml. Just future-date your posts, and they'll go live when that date rolls around. I use a version of this setup for my blog at greghaskins.com.

Setup

  1. Create a GitHub personal access token and save it somewhere. It needs to have the repo access scope (at least).

  2. Create a file at the root of your repo (e.g. .publish) with some dummy content.

    $ echo ".publish" > .publish
@maxivak
maxivak / readme.md
Last active February 19, 2025 23:23
Integrating Gem/Engine and Main Rails App
@alimbada
alimbada / Export-Chocolatey.ps1
Last active January 22, 2025 20:38
Export installed Chocolatey packages as packages.config - thanks to Matty666
#Put this in Export-Chocolatey.ps1 file and run it:
#.\Export-Chocolatey.ps1 > packages.config
#You can install the packages using
#choco install packages.config -y
Write-Output "<?xml version=`"1.0`" encoding=`"utf-8`"?>"
Write-Output "<packages>"
choco list -lo -r -y | % { " <package id=`"$($_.SubString(0, $_.IndexOf("|")))`" version=`"$($_.SubString($_.IndexOf("|") + 1))`" />" }
Write-Output "</packages>"
@lolzballs
lolzballs / HelloWorld.java
Created March 22, 2015 00:21
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
@Turbo87
Turbo87 / app.js
Created February 15, 2015 04:05
webpack + font-awesome test
require('font-awesome/css/font-awesome.css');
document.body.innerHTML = '<i class="fa fa-fw fa-question"></i>';
@ymjing
ymjing / Monaco for Powerline.md
Last active March 24, 2022 14:34
Powerline-patched Monaco for Windows and OSX

Powerline-patched Monaco for Windows and OSX

This font is manually patched with Fontforge. It includes the glyphs from DejaVu Sans Mono for Powerline.

I recommend DirectWrite-patched VIM builds. I'm using KaoriYa's build (http://www.kaoriya.net/software/vim/)

Usage

Add the following lines to your .vimrc/_vimrc:

@zetavg
zetavg / set-app.sh
Last active August 29, 2015 14:14
`bin/rake` tasks and `bin/rails console` with ease on AWS OpsWorks Instances running Unicorn Rails App Server.
# $ curl -L http://git.io/opsru_setapp > set-app.sh
# $ . set-app.sh app_name
#
# cd into app directory and sets the environment variables
# on AWS OpsWorks Instances running Unicorn Rails App Server.
APP_NAME=$1 && \
cd "/srv/www/${APP_NAME}/current" && \
export RAILS_ENV=production && \
cat "/srv/www/${APP_NAME}/shared/config/unicorn.conf" | grep ENV > "/tmp/${APP_NAME}_env" && \
@zetavg
zetavg / codeship_rails_opsworks_deploy.sh
Last active August 29, 2015 14:14
The script used to deploy Rails apps to AWS OpsWorks via Codeship.
#!/bin/sh
#
# The script used to deploy Rails apps to AWS OpsWorks via Codeship.
#
# It requires the following environment variables to be set:
#
# - AWS_ACCESS_KEY_ID
# - AWS_SECRET_ACCESS_KEY
# - APP_NAME
# - S3_BUCKET