Skip to content

Instantly share code, notes, and snippets.

@LeoNatan
LeoNatan / LNHiddenStrings.hh
Last active September 3, 2024 09:37
Hidden Strings
/**
The MIT License (MIT)
Copyright (c) 2024 Léo Natan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@alexanderisora
alexanderisora / finishJson5.ts
Created May 11, 2023 15:28
function to complete an unfinished JSON.
export const finishJson5 = (unfinishedJson5: string) => {
let stack = [];
let inDoubleQuotes = false;
let inSingleQuotes = false;
let inSingleLineComment = false;
for (let i = 0; i < unfinishedJson5.length; i++) {
const currentChar = unfinishedJson5[i];
const nextChar = unfinishedJson5[i + 1];
let prevChar;
@ianhanniballake
ianhanniballake / PickImageContracts.kt
Last active September 10, 2022 18:03
Gist showing how to write backward compatible ActivityResultContracts for supporting Android 13's new Photo Picker: https://developer.android.com/about/versions/13/features/photopicker
/**
* Use this [ActivityResultContract] to seamlessly switch between
* the new [MediaStore.ACTION_PICK_IMAGES] and [Intent.ACTION_GET_CONTENT]
* based on the availability of the Photo Picker.
*
* Use [PickMultipleImages] if you'd like the user to be able to select multiple
* photos/videos.
*
* Input: the mimeType you'd like to receive. This should generally be
* either `image/\*` or `video/\*` for requesting only images or only videos
import 'package:flutter/material.dart';
void main() async {
runApp(const DynamicHeader());
}
class DynamicHeader extends StatelessWidget {
const DynamicHeader({Key? key}) : super(key: key);
@override
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
@muhammetkole
muhammetkole / notification.apns
Created September 15, 2020 20:46
Example apns file for testing push notifications
{
"Simulator Target Bundle": "com.your.targets.bundle.identifier",
"aps": {
"alert": "Push Notifications Test",
"sound": "default",
"badge": 1
}
}
@hernandazevedo
hernandazevedo / screenshots.gradle
Last active April 21, 2022 15:52
Snapshots tests for android for a remote device such as Firebase Test Lab (Bitrise)
apply plugin: 'shot'
/*
Put this on any module you want to test with snapshots:
apply from: "../screenshots.gradle"
Put this on your root build.gradle
buildscript {
repositories {
google()
jcenter()
@outlyer
outlyer / fixepubencoding.sh
Created February 17, 2018 15:03
Tool to fix epub encoding for use with devices like the Amazon Kindle which do not handle high UTF characters and require HTML Entities
#!/bin/sh
#
IFS='|'
base=${1%%.*}
ext=${1#*.}
#if [[ $# -eq 0 ]] ; then
if [ "$ext" != "epub" ]; then
echo "Usage: $0 [EPUB FILE]"
@robmiller
robmiller / .gitconfig
Created July 17, 2013 07:52
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"