Skip to content

Instantly share code, notes, and snippets.

View AndreasMattsson's full-sized avatar

Andreas Mattsson AndreasMattsson

View GitHub Profile
@JakubNei
JakubNei / MyQuaternion.cs
Last active June 8, 2023 17:14
A custom completely managed implementation of UnityEngine.Quaternion. Base is decompiled UnityEngine.Quaternion. Doesn't implement methods marked Obsolete. Does implicit coversions to and from UnityEngine.Quaternion
using System;
using UnityEngine.Internal;
using UnityEngine;
using System.Runtime.Serialization;
using System.Xml.Serialization;
/// <summary>
/// Quaternions are used to represent rotations.
/// A custom completely managed implementation of UnityEngine.Quaternion
/// Base is decompiled UnityEngine.Quaternion
@paulirish
paulirish / what-forces-layout.md
Last active April 18, 2025 15:29
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@robe2
robe2 / makecurl_ssl.sh
Last active October 1, 2021 20:06
Building curl with ssl support under mingw64
export PROJECTS=/projects
export SOURCES=/sources
#build openssl
if true; then
cd ${PROJECTS}
mkdir ssl
cd ssl
cd ${SOURCES}
export PATH="/mingw/bin:/bin"
#Note that both EDB and BigSQL ship ssleasy32.dll, so you'll want to compile with a version of
@pardom-zz
pardom-zz / Properties.kt
Created July 4, 2015 00:47
Kotlin observable properties
import com.sun.jdi.InvalidTypeException
import java.util.LinkedHashSet
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
public object Properties {
fun observable<T>(initialValue: T): ReadWriteProperty<Any?, T> {
return ObservableProperty(initialValue)
}
}
@ilya-t
ilya-t / GLTextureView.java
Last active May 16, 2024 12:18
TextureView implementation for displaying openGL rendering
import android.content.Context;
import android.graphics.SurfaceTexture;
import android.opengl.GLSurfaceView;
import android.opengl.GLUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.TextureView;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
@mattpodwysocki
mattpodwysocki / eventsource.js
Last active September 23, 2019 15:34
Adding support for server-sent events for RxJS
if (!!root.EventSource) {
/**
* This method wraps an EventSource as an observable sequence.
* @param {String} url The url of the server-side script.
* @param {Observer} [openObserver] An optional observer for the 'open' event for the server side event.
* @returns {Observable} An observable sequence which represents the data from a server-side event.
*/
dom.fromEventSource = function (url, openObserver) {
return new AnonymousObservable(function (observer) {
@adammw
adammw / gist:6257550
Last active August 16, 2024 01:27
HLS / M3U8 Downloader for AES-128 Encrypted Streams
#!/usr/bin/env node
// M3U8 Downloader (not working)
var fs = require('fs');
var http = require('http');
var https = require('https');
var crypto = require('crypto');
var program = require('commander');
var ee = require('streamee');
@chadmaughan
chadmaughan / pre-commit.sh
Last active November 25, 2022 00:38
A git pre commit hook that runs the test task with the gradle wrapper
#!/bin/sh
# this hook is in SCM so that it can be shared
# to install it, create a symbolic link in the projects .git/hooks folder
#
# i.e. - from the .git/hooks directory, run
# $ ln -s ../../git-hooks/pre-commit.sh pre-commit
#
# to skip the tests, run with the --no-verify argument
# i.e. - $ 'git commit --no-verify'
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@harningt
harningt / SimpleCrypto.java
Created September 22, 2012 19:00
Simple Android Stream Crypto
package us.eharning.android.cryptosample;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.KeySpec;