Skip to content

Instantly share code, notes, and snippets.

View goreilly's full-sized avatar

Garrett O'Reilly goreilly

  • San Francisco, CA
View GitHub Profile
def code128spec(string)
lookup = %w(
\ ! " # $ % & ' ( ) * + , - . /
0 1 2 3 4 5 6 7 8 9
: ; < = > ? @
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
[ \\ ] ^ _ `
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
{ | } ~ )
@mixin child-widths($widths)
@for $i from 1 through length($widths)
$width: nth($widths, $i)
&:nth-child(#{$i})
width: $width
table.fixed
th, td
@include child-widths(100px 20px 10px 20px 20px)
@goreilly
goreilly / color.kt
Created February 1, 2018 23:22
Parse CSS colors in Kotlin
class Color(val red: Int, val green: Int, val blue: Int, val alpha: Float) {
companion object {
private val pattern = Pattern.compile("^rgba?\\((\\d+), (\\d+), (\\d+)(?:, ([\\d.]+))?\\)$")
fun fromString(string: String): Color? {
val matcher = pattern.matcher(string)
if (!matcher.matches()) return null
@goreilly
goreilly / dedupe.ps1
Created May 30, 2020 02:34
Remove duplicate files with same filename but different extension in powershell
Add-Type -AssemblyName Microsoft.VisualBasic
$items = Get-ChildItem -Path . -Recurse -Name "*.opus"
foreach ($item in $items) {
#Write-Host $item
$base = $item.Substring(0, $item.LastIndexOf('.'))
$ogg = $base + ".ogg"