Skip to content

Instantly share code, notes, and snippets.

@xedef
xedef / remove-indexing-files.md
Last active November 4, 2020 21:03
Remove all .DS_Store files (or any unwanted indexing file) from a S3 bucket, recursively

You can replace "*.DS_Store" with any other recurrent file (e.g. Desktop.ini)

Please!

Validate that you are going to delete only what you want passing the --dryrun option. I've left if by default just in case of copy/paste.

aws s3 rm s3://your.bucket.name/maybe-a-subkey --dryrun --recursive --exclude "*" --include "*.DS_Store"

@robweychert
robweychert / frame-based-animation.md
Last active September 8, 2021 15:19
A simple Sass function for frame-based CSS animation

A simple Sass function for frame-based CSS animation

If you have experience with animation in other media, CSS animation’s percentage-based keyframe syntax can feel pretty alien, especially if you want to be very precise about timing. This Sass function lets you forget about percentages and express keyframes in terms of actual frames:

@function f($frame) {
  @return percentage( $frame / $totalframes )
}
export const getImageWidthByUserContext = (width, MAX_WIDTH = 2880) => {
if (typeof(window) === 'undefined') return width;
// Pixel ratio
let qualityRatio = window.devicePixelRatio ? window.devicePixelRatio : 1;
// If bad connection, we downgrade
let type = null;
if (navigator && navigator.connection && navigator.connection.type) type = navigator.connection.type;
if (navigator && navigator.connection && navigator.connection.effectiveType) type = navigator.connection.effectiveType;
@OmarShehata
OmarShehata / Pixi.js Smoke Shader
Created May 16, 2016 14:45
Example of smoke shader in Pixi.js
<!DOCTYPE html>
<html>
<head>
<title>PixiJS Shaders</title>
<style type="text/css">
body {
margin: 0;
overflow: hidden;
}
</style>
@kishmiryan-karlen
kishmiryan-karlen / Apply LUT (LookUpTable).js
Created August 13, 2014 12:59
A function that helps to apply LUT to image. Make sure to change the canvas IDs or to create temporary canvases.
/**
* Created by Karlen on 13-Aug-14.
*/
var imageContext = document.getElementById('imageCanvas').getContext('2d'),
lutContext = document.getElementById('lutCanvas').getContext('2d');
function applyLUT(image, lut) {
var imageData, lutData, iData, lData;
@jeremypetrequin
jeremypetrequin / script
Created May 26, 2014 12:04
Find what f***** DOM element break your responsive by adding a horz scrollbar
//put this in your console, and see the red elements
var breakpoint = 320;
$('*').each(function() {
($t = $(this)).outerWidth() + $t.offset().left > breakpoint && console.log($t.css('background', 'red'));
});
@NOEinteractive
NOEinteractive / script.js
Created October 14, 2013 07:43
Placeholder polyfill with yepnope
//si le browser ne supporte pas l'attribut placeholder,
//ce JS va charger un polyfill et l'appliquer sur tous les inputs de la page
//https://github.com/mathiasbynens/jquery-placeholder
yepnope({
test:'placeholder' in document.createElement('input'),
nope: namespace.themeUrl+'/js/libs/jquery.placeholder.js',
callback: function(url, result, key) {
$.fn.placeholder && $('input').placeholder();
}
});
@mayoff
mayoff / makeAnimatedGif.m
Created February 16, 2013 23:00
Example of creating an animated GIF on iOS, with no 3rd-party code required. This should also be easy to port to OS X.
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
static UIImage *frameImage(CGSize size, CGFloat radians) {
UIGraphicsBeginImageContextWithOptions(size, YES, 1); {
[[UIColor whiteColor] setFill];
UIRectFill(CGRectInfinite);
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(gc, size.width / 2, size.height / 2);
@thbkrkr
thbkrkr / Default (Linux).sublime-keymap
Last active August 31, 2022 03:54
Custom & Eclipse shortcuts key bindings (keyboard mapping) for Sublime Text 2 and 3
[
{ "keys": ["f12"], "command": "htmlprettify"},
{ "keys": ["f1"], "command": "fold" },
{ "keys": ["f2"], "command": "unfold" },
{ "keys": ["ctrl+à"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
{ "keys": ["ctrl+!"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },