Skip to content

Instantly share code, notes, and snippets.

View pieplu's full-sized avatar

Alexis Piéplu pieplu

View GitHub Profile
@paulirish
paulirish / rAF.js
Last active June 23, 2024 04:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@kelan
kelan / generate_personal_podcast.rb
Created January 22, 2012 23:55
A script for generating a personal podcast feed from mp3 files in a public Dropbox folder.
#!/usr/bin/env ruby -wKU
#
# by Kelan Champagne
# http://yeahrightkeller.com
#
# A script to generate a personal podcast feed, hosted on Dropbox
#
# Inspired by http://hints.macworld.com/article.php?story=20100421153627718
#
# Simply put this, and some .mp3 or .m4a files in a sub-dir under your Dropbox
@max
max / gist:5708466
Created June 4, 2013 18:54
Flat UI Colors as Sass variables
// I needed flatuicolors.com as Sass variables...
// In your console, run:
$('.color').get().map(function(el) { return "$" + el.classList[1] + ": " + el.getAttribute('data-clipboard-text') + ';' }).join('\r\n');
// Output:
// $turquoise: #1abc9c;
// $emerland: #2ecc71;
// $peter-river: #3498db;
// $amethyst: #9b59b6;
// $wet-asphalt: #34495e;
@madeingnecca
madeingnecca / gist:9f7bcabc00dd2b1d91e7
Last active March 11, 2016 10:01
LIFERAY VELOCITY utils
## Print article date with a localized format.
##############################################
#set ($localeDefault = $localeUtil.getDefault())
## Convert string (with a particular input format) to a Date object.
#set ($modifiedDate = $dateTool.toDate("EEE, dd MMM yyyy hh:mm:ss Z", $reserved-article-display-date.getData(), $localeDefault))
## Get the localized format as a string.
#set ($dateFormat = "#language ('custom-medium-dateformat-pattern')")
$dateTool.format($dateFormat, $modifiedDate)
@cmbaughman
cmbaughman / vagrant-win-howto.md
Last active September 7, 2018 09:15
Vagrant >=1.6 Windows Instructions

How to set up a Windows VM with Vagrant

Create your VM

==================

  1. Obtain a windows vm from Modern IE.
  • Win 8 OSX
curl -O -L "https://www.modern.ie/vmdownload?platform=mac&virtPlatform=virtualbox&browserOS=IE10-Win8.1&parts=5&filename=VMBuild_20131127/VirtualBox/IE10_Win8/Mac/IE10.Win8.For.MacVirtualBox.part{1.sfx,2.rar,3.rar,4.rar,5.rar}"
@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

@paulirish
paulirish / what-forces-layout.md
Last active June 26, 2024 20:47
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
@mariosant
mariosant / deploy.sh
Last active May 5, 2017 02:05
Use lftp to deploy Grav websites
#! /bin/bash
./bin/grav clear-cache
lftp -c "open \
-u $FTP_USER,$FTP_PASSWORD $DEST_DOMAIN; \
set ftp:ssl-allow off; \
mirror -R ${HOME}/workspace/ $DEST_DIR \
--exclude .git/ --exclude .c9/ --exclude backup/ \
--delete"

The error handling for async/await with try/catch always bugs me. Go to the rescue?

function to(promise) {
  return promise
    .then(res => [null, data])
    .catch(err => [err])
}

async function doIt() {
@jak
jak / fedora.md
Last active August 4, 2019 21:09 — forked from jpuskar/fedora.md
Installing Fedora 26 on Macbook Pro Retina 2016

Installing Fedora on Macbook Pro retina

  1. Download Fedora 26 iso, create a usb bootable media
  2. Use diskutil list to figure out which drive is the usb, on macbook pro with 1 hardrive, the usb is /dev/disk2
  3. Umount the disk using diskutil unmountDisk /dev/disk2 or use Mac's Disk Utility (just umount, don't eject, umount removes it from directory structure and eject disconncet it altogether)
  4. Use dd(a low level cp) to write iso content into the usb drive, sudo dd if=~/Downloads/Fedora-Live-Desktop-x86_64-20-1.iso of=/dev/rdisk2 bs=8m, this will take a bit of time, make sure you wait until it's done, additionally compare the size or checksum to make sure all has been copied (not that necessary since if it weren't copied, it'll err at boot time)
  5. Use Disk Utility to shrink Mac's harddrive to create partition for the subsequent fedora installation
  6. Boot to recovery mode (cmd+r) and disable SIP (termina