Skip to content

Instantly share code, notes, and snippets.

View lucasdinonolte's full-sized avatar
:shipit:

Lucas Dino Nolte lucasdinonolte

:shipit:
View GitHub Profile
@lucasdinonolte
lucasdinonolte / BinomService.java
Created April 2, 2014 18:37
Some Java Action
// Das Resultat passt nicht, weil long 8 byte groß ist, also maximal 1.8446744e+19 sein kann
// 49! ist aber 6.0828186e+62 und passt nicht rein, also schneidet der die Bytes ab und das Ergebnis passt nicht mehr
public class BinomService {
public static void main(String[] args) {
System.out.println(binom(49, 6));
}
public static long fac(int n) {
if(n == 1) {
@lucasdinonolte
lucasdinonolte / responsive.sass
Created August 5, 2014 17:35
Quick exemplary responsive SASS Setup
$max-page-width: 1600px
$min-page-width: 320px
$compact-max-page-width: 500px
$break-xsmall: 320px
$break-small: 480px
$break-medium: 700px
$break-large: 880px
$break-xlarge: 1280px
@lucasdinonolte
lucasdinonolte / table2.sass
Last active August 29, 2017 20:20
A collection of techniques for responsive tables
.c-table
+half-spacing(margin-bottom)
+text-copy-s
vertical-align: top
td,
th
+medium-spacing(padding)
vertical-align: top
border-bottom: 1px solid $border-color
@lucasdinonolte
lucasdinonolte / everything.pde
Created January 12, 2015 20:37
Trippy @daelzicht
// Run with AllInputsFirmata
import themidibus.*; //Import midibus library
import processing.serial.*; //Import serial library
import cc.arduino.*;
// Wanna use midi input?
boolean useMidi = false;
// Arduino Ports
int button = 7;
@lucasdinonolte
lucasdinonolte / glitcher.php
Created October 5, 2015 12:05
PHP based Image Glitcher
<?php
header('Content-Type: image/jpeg');
$contents = file_get_contents($_GET['img']);
$mutations = $_GET['mutations'];
for($i = 0; $i < $mutations; $i++) {
$contents = substr_replace($contents, str_shuffle("asdw4t98wfh9p8w3th98w3tsetf9wgt98hgt98rzt98hwz"), rand(strlen($contents)/10, strlen($contents)), 0);
# type your Python code here and press cmd+Return to run.
reference = "n"
glyph = Glyphs.font.glyphs[reference].layers[0]
referenceWidth = glyph.width - glyph.LSB - glyph.RSB
print "Reference:", reference, referenceWidth
for char in ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]:
curGlyph = Glyphs.font.glyphs[char].layers[0]
width = curGlyph.width - curGlyph.LSB - curGlyph.RSB
# Linter Options
options:
merge-default-rules: false
formatter: stylish
max-warnings: 50
# File Options
files:
include: '**/*.s+(a|c)ss'
@lucasdinonolte
lucasdinonolte / _transitions.sass
Created August 22, 2017 14:35
SASS Mixins for nice transitions
// These default values could be overwritten in a potentially cleaned up global config file ;-)
$transition--easing: cubic-bezier(0.4, 0, 0.2, 1) !default
$transition--slow: '0.2s 0.1s' !default
$transition--fast: '0.1s' !default
// The main mixin
=transition($speed, $properties...)
$transitions: ()
// Timing is fast, unless 'slow' is specified
@lucasdinonolte
lucasdinonolte / _quotes.sass
Created October 11, 2017 13:24
Language specific quotation marks
// Wrap the quotes
// in language specific
// quotation marks if a
// language is specified
// ---------------------
// German Quotes
.c-quote--german &,
html:lang(de) &
&::before
content: '„'
@lucasdinonolte
lucasdinonolte / batch-update-sidebearings.py
Created October 7, 2018 17:34
Glyphs App Batch Update Sidebearings by factor
scale = 1.166666667
for char in Glyphs.font.selectedLayers:
if char.LSB < 0:
char.LSB = round(char.LSB/scale)
else:
char.LSB = round(char.LSB*scale)
if char.RSB < 0:
char.RSB = round(char.RSB/scale)
else: