Skip to content

Instantly share code, notes, and snippets.

Avatar

Shilo Shilo

View GitHub Profile
@Shilo
Shilo / ArchiveAndPackageApp.sh
Last active Aug 5, 2020
Bash shell script to clean, archive, and package xcode project. (Script extension can be renamed to .command to make it executable. Script must be located in the same directory as the .xcodeproj file)
View ArchiveAndPackageApp.sh
#!/bin/bash
#configurable variables
SCHEME_NAME="SCHEME-NAME-HERE"
DEVELOPER_NAME="iPhone Distribution: YOUR_DEVELOPER_NAME_HERE (ID_HERE)"
PROVISIONING_PROFILE="/ABSOLUTE/PATH/TO/PROVISIONING/PROFILE_HERE.mobileprovision"
USE_DEFAULT_DEVELOPER_NAME=true
USE_DEFAULT_PROVISIONING_PROFILE=true
OPEN_DIR_WHEN_FINISHED=false
@Shilo
Shilo / JavaSetTimeout.java
Last active Jul 21, 2020
Java "setTimeout" equivalent. (Credit: Oleg Mikhailov, http://stackoverflow.com/a/36842856)
View JavaSetTimeout.java
// Asynchronous implementation with JDK 1.8:
public static void setTimeout(Runnable runnable, int delay){
new Thread(() -> {
try {
Thread.sleep(delay);
runnable.run();
}
catch (Exception e){
System.err.println(e);
}
View cross-browser-opacity.css
selector {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
filter: alpha(opacity=30);
-moz-opacity: 0.3;
-khtml-opacity: 0.3;
opacity: 0.3;
}
View preserve-pixelation.scss
@mixin pixelated {
-ms-interpolation-mode: nearest-neighbor; // IE 7+ (non-standard property)
image-rendering: -webkit-optimize-contrast; // Safari 6, UC Browser 9.9
image-rendering: -webkit-crisp-edges; // Safari 7+
image-rendering: -moz-crisp-edges; // Firefox 3.6+
image-rendering: -o-crisp-edges; // Opera 12
image-rendering: pixelated; // Chrome 41+ and Opera 26+
}
@Shilo
Shilo / _how_to_in_chrome.md
Last active Sep 27, 2019
Hide Twitch subscription badges. Why? I don't know. For fun.
View _how_to_in_chrome.md

In chrome desktop browser:

  • Copy the below text of "hide_subs_badset.js" file.
  • Go to the tab of the active twitch channel you want to hide the subscription badges.
  • Press Ctrl+Shift+J to open Javascript console window.
  • Paste the previously copied text in the console window and press enter.
  • Enjoy the hidden badges, because I don't know. For fun?
@Shilo
Shilo / CameraExtensions.cs
Last active Jul 4, 2019
Unity camera extensions to hide/show specific layers.
View CameraExtensions.cs
using UnityEngine;
public static class CameraExtensions {
public static void LayerCullingSetVisible(this Camera cam, int layerMask, bool visible) {
if (visible) LayerCullingShow(cam, layerMask);
else LayerCullingHide(cam, layerMask);
}
public static void LayerCullingSetVisible(this Camera cam, string layer, bool visible) {
if (visible) LayerCullingShow(cam, layer);
@Shilo
Shilo / logcat_unity_debug.bat
Last active Jul 4, 2019
Command prompt command to trace Unity logs in runtime on android via logcat.
View logcat_unity_debug.bat
adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG
@Shilo
Shilo / UIImage+Additions.h
Created Oct 17, 2011
A UIImage category that will replace or remove colors. This allows multiple colors to be changed on a single image, until it has alpha values.
View UIImage+Additions.h
//
// UIImage+Additions.h
// Sparrow
//
// Created by Shilo White on 10/16/11.
// Copyright 2011 Shilocity Productions. All rights reserved.
//
#define COLOR_PART_RED(color) (((color) >> 16) & 0xff)
#define COLOR_PART_GREEN(color) (((color) >> 8) & 0xff)
@Shilo
Shilo / ViewController.swift
Created Jul 31, 2017
Swift snippet for jumping to a specific PDF page in WKWebView.
View ViewController.swift
func webViewGotoPDFPage(index: Int) {
if (index < 1) { return; }
let pageCount = totalPDFPages(filePath: webViewLastURL!);
let pageIndex = max(min(index, pageCount), 1)-1;
/*
let firstPage = self.webView.scrollView.subviews[2].subviews[0];
//let contentHeight = self.webView.scrollView.contentSize.height;
//let totalPaddingSize = CGFloat(PDF_INNER_PADDING)*(CGFloat(pageCount)-1) + CGFloat(PDF_OUTER_PADDING)*2;
@Shilo
Shilo / export_aseprite_layers.bat
Created Apr 27, 2019
Batch script to automatically save Aseprite file into layer images for easy import into external animation applications such as Spine and Spriter Pro. (Batch script has to be in same directory and same filename as Aseprite file)
View export_aseprite_layers.bat
@echo off
@set ASEPRITE="C:\Program Files (x86)\Steam\steamapps\common\Aseprite\Aseprite.exe"
@set FILENAME="%~n0"
if exist %FILENAME% (
choice /c YN /m "Would you like to delete and recreate '%FILENAME%' directory "
if errorlevel == 2 goto save
if errorlevel == 1 goto delete
goto end
)
You can’t perform that action at this time.