Skip to content

Instantly share code, notes, and snippets.

View Grsmto's full-sized avatar

Adrien Denat Grsmto

View GitHub Profile
@Grsmto
Grsmto / Export Layers To Files.jsx
Created July 30, 2014 11:01
Photoshop script 'Export Layers To Files' with clean files name
// Copyright 2007. Adobe Systems, Incorporated. All rights reserved.
// This script will export each layer in the document to a separate file.
// Written by Naoki Hada
// ZStrings and auto layout by Tom Ruark
/*
@@@BUILDINFO@@@ Export Layers To Files.jsx 1.0.0.17
*/
/*
@Grsmto
Grsmto / gist:4478209
Created January 7, 2013 20:41
Javascript - "arguments.callee" technique : this value points to the anonymous function in which the code is executing.
var todo = items.concat(); //create a clone of the original array
setTimeout(function(){
//get next item in the array and process it
process(todo.shift());
//if there's more items to process, create another timer
if(todo.length > 0){
setTimeout(arguments.callee, 25); // arguments.callee = anonymous function where the code is executing
} else {
@Grsmto
Grsmto / index.html
Created June 23, 2013 19:07
Chrome Android pixel snapping test
<!DOCTYPE html>
<!--[if IEMobile 7 ]> <html class="no-js iem7"> <![endif]-->
<!--[if (gt IEMobile 7)|!(IEMobile)]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
@Grsmto
Grsmto / wr-reversepathdirection.js
Created July 16, 2015 15:44
Reverse a path in Adobe Illustrator
//////////////////////////////////////////////////////////// english //
// -------------------------------
// -=> WR-reversePathDirection <=-
// -------------------------------
//
// A Javascript for Adobe Illustrator
// by Wolfgang Reszel (ai-js@rumborak.de)
//
// Version 0.2 from 1.12.2004
//
var path = require('path');
var autoprefixer = require('autoprefixer');
var postcssFlexbugsFixes = require('postcss-flexbugs-fixes');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
var WatchMissingNodeModulesPlugin = require('../scripts/utils/WatchMissingNodeModulesPlugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var paths = require('./paths');
ffmpeg -i video.mp4 -vf scale=1280x720 -b:v 1024k \
-minrate 512k -maxrate 1485k -tile-columns 2 -g 240 -threads 8 \
-quality good -crf 33 -c:v libvpx-vp9 \
-pass 1 -speed 4 -strict -2 video.webm && \
ffmpeg -i video.mp4 -vf scale=1280x720 -b:v 1024k \
-minrate 512k -maxrate 1485k -tile-columns 2 -g 240 -threads 8 \
-quality good -crf 33 -c:v libvpx-vp9 \
-pass 2 -speed 4 -strict -2 -y video.webm
@Grsmto
Grsmto / prismic-prepare-translations.js
Created December 8, 2017 13:09
Node.js script to prepare files for translation on Prismic.io
var fs = require('fs');
var dirPath = './imports';
var lang = 'de-de';
var files = fs.readdirSync(dirPath).filter(item => !(/(^|\/)\.[^\/\.]/g).test(item));
files.forEach(function(file) {
fs.readFile(dirPath + '/' + file, function(error, data) {
if (error) {
@Grsmto
Grsmto / settings.json
Created February 20, 2018 11:30
Sublime Text to Visual Studio Code settings
{
"editor.minimap.enabled": false,
"workbench.editor.labelFormat": "short",
"workbench.editor.tabSizing": "shrink",
"workbench.editor.enablePreview": false,
"editor.formatOnPaste": true,
"workbench.editor.showIcons": false,
}
@Grsmto
Grsmto / next.config.js
Created June 15, 2018 08:39
Next.js support for css-modules & normal css at the same time, same behaviour as CRA
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const cssLoaderConfig = require('@zeit/next-css/css-loader-config');
const commonsChunkConfig = (config, test = /\.css$/) => {
config.plugins = config.plugins.map(plugin => {
if (
plugin.constructor.name === 'CommonsChunkPlugin' &&
// disable filenameTemplate checks here because they never match
// (plugin.filenameTemplate === 'commons.js' ||
// plugin.filenameTemplate === 'main.js')
@Grsmto
Grsmto / sanity-cheatsheet.md
Last active July 13, 2020 20:12
Sanity cheatsheet

Sanity.io CheatSheet

Copy content of document in clipboard

> sanity documents get document-id | pbcopy

Edit document from CLI

First make sure to define your editor using EDITOR=code (for vscode).

&gt; sanity documents create --id documentId --watch --replace