Skip to content

Instantly share code, notes, and snippets.

View nesk's full-sized avatar

Johann Pardanaud nesk

View GitHub Profile
@import Darwin;
@import ObjectiveC;
@import CloudKit;
extern bool GEOConfigGetBOOL(int feature, void* something);
// Hooks feature flags in a resigned Maps.app to return true.
// Usage:
// clang -shared -fmodules -o libmaps_inject.dylib maps_inject.m \
// "$(xcrun
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@gregopet
gregopet / debate.adoc
Last active June 19, 2023 19:19
Validation library requirements

What I expect from a validation library

I’m documenting for myself what I would look for in a validation library. The code I currently need it for is in Kotlin so I have the entire JVM ecosystem to choose from.

JSR 303 and JSR 349

Certainly well battle tested but I dislike the annotations approach; while nice for simple validations it can get hairy when testing real scenarios:

@chalasr
chalasr / EnhancedRepository.php
Last active September 26, 2023 00:59
Implements a custom EntityRepository using Factory in Symfony2.6+
<?php
namespace App\Util\Doctrine\Repository;
use App\Util\Doctrine\Entity\AbstractEntity;
use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
@jeffjohnson9046
jeffjohnson9046 / UuidHelper.java
Last active December 11, 2023 11:06
Convert UUID to byte array and vice versa. Useful for when UUIDs are stored in MySQL tables as VARBINARY(16)
import java.nio.ByteBuffer;
import java.util.UUID;
public class UuidAdapter {
public static byte[] getBytesFromUUID(UUID uuid) {
ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
bb.putLong(uuid.getMostSignificantBits());
bb.putLong(uuid.getLeastSignificantBits());
return bb.array();
/**
* Returns the global object.
* Works even inside ES6 modules.
*/
function getGlobalObject() {
// Workers don’t have `window`, only `self`
if (typeof self !== 'undefined') {
return self;
}
if (typeof global !== 'undefined') {
@enricodeleo
enricodeleo / margin-padding.sass
Last active November 17, 2017 21:06
Loop that generates margin and padding class helpers
// loop that generates margin ad padding helper classes
// the output is like .margin-5, .margin-top-5, margin-right-5 etc...
$properties: (margin, padding);
$sides: (top, right, bottom, left);
@each $prop in $properties {
@for $i from 1 through 14 {
.#{$prop}-#{$i*5} {
#{$prop}: #{$i*5}px !important;
}
@each $side in $sides {
@touilleMan
touilleMan / SimpleHTTPServerWithUpload.py
Last active March 16, 2024 13:08 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload - Python3 version
#!/usr/bin/env python3
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
see: https://gist.github.com/UniIsland/3346170
"""
@bobbygrace
bobbygrace / trello-css-guide.md
Last active February 13, 2024 14:31
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active January 16, 2024 01:17
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {