Skip to content

Instantly share code, notes, and snippets.

View solarsailer's full-sized avatar

Matthieu Oger solarsailer

View GitHub Profile
@solarsailer
solarsailer / convert_cm_to_px.sh
Last active August 29, 2015 14:15
Convert CM to Pixels.
# CM to PX.
DPI * (XXX cm / 2.54 cm) = size in pixels.
@solarsailer
solarsailer / scale.sh
Created June 30, 2015 09:25
Put in an Automator service with "Run Shell Script" (set with "Pass Input as Arguments").
for f in "$@"
do
mime=`file --mime-type $f`
if [[ $mime == *"image/"* ]]
then
/usr/local/bin/mogrify -scale 400% -strip $f
fi
done
@solarsailer
solarsailer / ScreenManager.cs
Created December 15, 2015 14:09
Unity Screen Manager
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
// Based on http://docs.unity3d.com/Manual/HOWTO-UIScreenTransition.html tutorial.
public class ScreenManager : MonoBehaviour
{
#region Constants
@solarsailer
solarsailer / Gemfile
Created March 15, 2016 20:53
Jekyll Autoprefixer
# ...
# Add this to your Gemfile:
gem 'autoprefixer-rails'
@solarsailer
solarsailer / throwing.swift
Created July 8, 2016 20:47
Throwing functions
// Is there a reason to why the `throws` keyword is at this position:
func send() throws -> String {}
// Instead of…
throwing func send() -> String {}
// Like `mutating` is declared:
mutating func send() -> String {}
// To be consistant, throwing should be at the start of the declaration, right?
@solarsailer
solarsailer / globals.css
Last active December 6, 2016 10:48
CSS globals.
@charset "UTF-8";
/* ---------------------------------------------------------- *\
* # Globals
\* ---------------------------------------------------------- */
/**
* Box-model:
* 1. Change default box-model to border-box.
* 2. All elements will inherit from the <html> box-model.
@solarsailer
solarsailer / open_iterm.applescript
Last active February 6, 2017 18:41
Open current Finder window in iTerm (for Finder toolbar usage)
on run
tell application "Finder"
try
set targetPath to (quoted form of POSIX path of (folder of the front window as alias))
on error
set targetPath to "~"
end try
end tell
my openTerminal(targetPath)
@solarsailer
solarsailer / README.md
Last active July 31, 2017 16:20
webpack configuration for Sass, Autoprefixer, CSS, CSS Modules and ES6+

Structure

📄 webpack.config.js
📄 package.json
📁 scripts/
  📄 manifest.js
  📄 index.js
📁 stylesheets/
 📄 main.scss
import {injectGlobal} from 'styled-components'
injectGlobal`
p {
color: red;
}
`
@solarsailer
solarsailer / Matthieu Oger.lrtemplate
Created July 2, 2018 22:34
Lightroom custom metadata panel
-- Copy in "~/Library/Application Support/Adobe/Lightroom/Metadata Field Lists/Matthieu Oger.lrtemplate"
return {
version = 1,
title = "Matthieu Oger",
id = "info.regex.lrmeta.v1.mo",
type = "MetadataFieldList",
items = {
{ formatter = 'com.adobe.captureDate', label="Date" },
{ formatter = 'com.adobe.captureTime', label="Time" },