Skip to content

Instantly share code, notes, and snippets.

View sandcastle's full-sized avatar
🍦

Glenn Morton sandcastle

🍦
View GitHub Profile
@pseudosavant
pseudosavant / createImageBitmap.js
Last active March 20, 2022 12:30 — forked from MonsieurV/createImageBitmap.js
createImageBitmap polyfill with support for CanvasImageSource (img, video, canvas) sources, Blobs, and ImageData. https://createimagebitmap-polyfill.glitch.me/
/*
* Polyfill for createImageBitmap
* https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap
*
* Supports CanvasImageSource (img, video, canvas) sources, Blobs, and ImageData.
*
* From:
* - https://dev.to/nektro/createimagebitmap-polyfill-for-safari-and-edge-228
* - https://gist.github.com/MonsieurV/fb640c29084c171b4444184858a91bc7
* Updated by:
@dracos
dracos / gist:e48d6feb25d3f7a8d706a2945fbf1930
Created May 8, 2019 14:33
Collapse GitHub project columns
// ==UserScript==
// @name Collapse project columns
// @namespace mysociety.github.projects.collapse
// @description Collapse project columns (based on https://gist.github.com/yuyuvn/268c754325e945ceda24e4ce661a27ce)
// @include https://github.com/*/*/projects/*
// @version 1.0
// @grant none
// ==/UserScript==
document.querySelectorAll(".js-details-container").forEach(function(node){
@bambooom
bambooom / puppeteer-gif.js
Last active February 3, 2024 06:08
use puppeteer to generate gif
const fs = require('fs');
const puppeteer = require('puppeteer');
const GIFEncoder = require('gifencoder');
const PNG = require('png-js');
function decode(png) {
return new Promise(r => {png.decode(pixels => r(pixels))});
}
@jeremywadsack
jeremywadsack / load_balancer
Created March 28, 2017 21:54
Create a Google Cloud HTTPS Load Balancer (with Cloud CDN) that fronts a Kubernetes service hosted in a GKE cluster exposed on a NodePort.
#!/usr/bin/env bash
# TODO: Fill in these details for the cluster and project:
# The GKE cluster
CLUSTER=
# Assume the app is named the same as the working directory
APP=$(basename $(pwd))
# The GKE tag that identifies the cluster nodes
CLUSTER_TARGET_TAG=
# Expects to have `tls.crt` and `tls.key` in this folder
@atraver
atraver / ServerRequestManager.cs
Created June 20, 2016 23:04
UnityWebRequest Dispose example
private IEnumerator ExecuteRequest<T>(BuildRequestDelegate builder, ResponseDelegate<T> callback,
Action cancelCallback, RequestOptions requestOptions)
{
using(UnityWebRequest serverRequest = builder())
{
bool showActivityIndicator = ((requestOptions & RequestOptions.ShowActivityIndicator) == RequestOptions.ShowActivityIndicator);
bool forceRetry = ((requestOptions & RequestOptions.ForceRetry) == RequestOptions.ForceRetry);
float startTime = Time.realtimeSinceStartup;
yield return serverRequest.Send();
@steipete
steipete / ios-xcode-device-support.sh
Last active December 12, 2023 03:36
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@davidfowl
davidfowl / Example1.cs
Last active March 28, 2024 20:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@keijiro
keijiro / PbxModifier.cs
Created July 2, 2015 03:08
(Unity Xcode Manipulation API) An example which modifies compiler flags for a given source file.
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using System.IO;
public class PbxModifier
{
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
@llaughlin
llaughlin / tasks.json
Last active April 28, 2016 11:03
VSCode+Golang
{
"version": "0.1.0",
"command": "go",
"args": ["build"],
"isShellCommand": true,
"showOutput": "silent",
"problemMatcher": {
"owner": "go",