Skip to content

Instantly share code, notes, and snippets.

@hongymagic
hongymagic / Interval.cs
Last active December 15, 2023 13:09
Representing Intervals in C# with Generics support `Interval<T>`
using System;
namespace Hongy
{
/// <summary>
/// Represents vectorless interval of the form [a, b] or (a, b) or any
/// combination of exclusive and inclusive end points.
/// </summary>
/// <typeparam name="T">Any comparent type</typeparam>
/// <remarks>
@kristopherjohnson
kristopherjohnson / StringBuilder.swift
Last active March 12, 2024 19:07
A StringBuilder class for Swift
/**
Supports creation of a String from pieces
*/
public class StringBuilder {
private var stringValue: String
/**
Construct with initial String contents
:param: string Initial value; defaults to empty string
@willpatera
willpatera / Google-Sheet-Form-Post.md
Last active May 3, 2024 12:57
Post to google spreadsheet from html form

Overview

This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Depreciation Warning: This code is not maintained, and should be seen as reference implementation only. If you're looking to add features or update, fork the code and update as needed.

Run example

You should be able to just open index.html in your browser and test locally.

@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-color.md
Last active August 29, 2022 15:54
GLSL color functions

RGB - YUB

mat3 yuv2rgb = mat3(1.0, 0.0, 1.28033, 1.0, -0.21482, -0.38059, 1.0, 2.12798, 0.0);
mat3 rgb2yuv = mat3(0.2126, 0.7152, 0.0722, -0.09991, -0.33609, 0.43600, 0.615, -0.5586, -0.05639);

RGB - HSV

@danharper
danharper / background.js
Last active May 22, 2024 11:09
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@indyfromoz
indyfromoz / Alter-Collation.sql
Created October 31, 2013 05:34
Alter the collation of a SQL database
USE master;
GO
ALTER DATABASE MyOptionsTest
COLLATE French_CI_AS ;
GO
--Verify the collation setting.
SELECT name, collation_name
FROM sys.databases
WHERE name = N'MyOptionsTest';
@aprato
aprato / AMPNavigationBar.m
Last active July 13, 2018 00:23
Darker iOS7 translucent UINavigationBar
// .h
@interface AMPNavigationBar : UINavigationBar
@property (nonatomic, assign) CGFloat extraColorLayerOpacity UI_APPEARANCE_SELECTOR;
@end
// .m
@anth-3
anth-3 / passThruProxy.cs
Last active April 24, 2019 11:18
Defines a simple pass-through proxy interface for C#.NET (IIS) Server applications and web sites.
<%@ WebHandler Language="C#" Class="PassThruProxy" Debug="true" %>
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Web;
/**
* <summary><c>PassThruProxy</c> is a simple pass-through proxy interface for C#.NET (IIS Servers).</summary>
@pixnbit
pixnbit / CIFaceFeature+UIImageOrientation.h
Last active May 3, 2018 01:59
Category on CIFaceFeature to convert CGPoint and CGRect with respect to UIImageOrientation, also with handy helpers to convert locations inside of a given UIView size.
//
// CIFaceFeature+UIImageOrientation.h
//
//
// Created by Xiaochao Yang on 6/9/13.
// Copyright (c) 2013 Xiaochao Yang. All rights reserved.
//
#import <CoreImage/CoreImage.h>