Skip to content

Instantly share code, notes, and snippets.

View Victa's full-sized avatar
🏠
Working from home

Victor Coulon Victa

🏠
Working from home
View GitHub Profile
@razwan
razwan / _baseline.scss
Created April 14, 2014 16:20
Aligning type to baseline the right way with SASS
$base-font-size: 16px;
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@adamcooke
adamcooke / cloudapp-export.rb
Created January 11, 2013 15:45
Export all your drops from CloudApp using this quick Ruby script
#!/usr/bin/env ruby
# A quick script to download all your files from CloudApp.
# To run this just run the script passing your e-mail & password
# to the script, for example:
#
# gem install cloudapp_api
# ruby cloudapp-export.rb [email protected] mypassword
#
@kewah
kewah / css-animation.js
Created January 9, 2013 14:49
JavaScript snippet to get CSS Animation event types (animationstart, animationend, animationiteration).
var CSSAnimation = (function(window, document, undefined) {
'use strict';
function camelCaseEventTypes(prefix) {
prefix = prefix || '';
return {
start: prefix + 'AnimationStart',
end: prefix + 'AnimationEnd',
iteration: prefix + 'AnimationIteration'
@drublic
drublic / rem-fallback.less
Last active March 28, 2020 23:57
Fallback rem-mixin in Sass and LESS
@main-font-size: 16px;
.x-rem (@property, @value) {
// This is a workaround, inspired by https://github.com/borodean/less-properties
@px-fallback: @value * @main-font-size;
-: ~`(function () { return ';@{property}: @{px-fallback}'; }())`;
-: ~`(function () { return ';@{property}: @{value}rem'; }())`;
}
@Warry
Warry / Article.md
Created December 11, 2012 00:11
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@joshnesbitt
joshnesbitt / watch.rb
Created November 30, 2012 15:05 — forked from JamieMason/watch.rb
Watch a folder for changes to files, then reload Chrome
#!/usr/bin/env ruby
require 'tempfile'
require 'fileutils'
# Signals
trap("SIGINT") { exit }
# Setup
TARGET_FOLDER = ARGV[0]
TARGET_URL = ARGV[1]
@JamieMason
JamieMason / z-indexes.css
Created November 30, 2012 09:48
Keep all z-index definitions in the same file to keep track of them more easily
/*------------------------------------*\
$Z-INDEXES
\*------------------------------------*/
/**
* Ordered in the same stacking order as the values define;
* Highest first/top to lowest last/bottom
*/
.foo { z-index: 30; }
@kaelig
kaelig / README.md
Created November 28, 2012 11:10
HiDPI sprites with Compass
@kaelig
kaelig / _grid.scss
Created November 27, 2012 12:38
Responsive News Grid system
$bootstrap: false !default;
$scaffold: true !default; // Output .span-n classes?
$selector-type: if($scaffold, ".", "%") !default;
$old-ie: false !default;
$total-columns: 12 !default;
$gutter: 8px !default;
$container-width: 100% !default;
$min-width: 240px !default;