Skip to content

Instantly share code, notes, and snippets.

View Lachee's full-sized avatar
📖
xkcd.com/1421/

Lake Lachee

📖
xkcd.com/1421/
View GitHub Profile
@paulferrett
paulferrett / abn_validator.php
Created December 27, 2013 01:45
Here is a PHP validation class to validate Australian Business Numbers (ABN) and Australian Company Numbers (ACN)
<?php
/**
* ABN and ACN Validator Class
* @author Paul Ferrett, 2009 (http://www.paulferrett.com)
*/
class AbnValidator {
/**
* Return true if $number is a valid ABN
@nabil-boag
nabil-boag / gist:8537228
Created January 21, 2014 09:46
PHP Function for array zip merge. Merges two arrays like a zipping. Uneven sized arrays get items appended to the end.
/**
* Merges two arrays like a zipping. Uneven sized arrays get items
* appended to the end.
*
* @param array $a An array to merge
* @param array $b Another array to merge
* @return array An array of merged values
*/
function array_zip_merge(array $a, array $b) {
$return = array();
@dogfuntom
dogfuntom / CodeGenerator_Window.cs
Last active September 7, 2023 17:10
[Unity CodeDom] Editor-time code generator. Generates constant-declaration-only classes for Tags, Layers, Sorting layers and Input axes. Good for type-safety. #Unity #Unity3d #CodeDom
using Microsoft.CSharp;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
@joyrexus
joyrexus / http-errors.js
Created June 6, 2016 23:30 — forked from moleike/http-errors.js
HTTP Error classes in Node.js
'use strict';
const statusCodes = require('http').STATUS_CODES;
function createError(code, name) {
return function(message) {
Error.captureStackTrace(this, this.constructor);
this.name = name;
this.message = message;
this.statusCode = code;
}
@mwrouse
mwrouse / Autocomplete.js
Last active April 25, 2024 08:47
Autocompletion for an object in the monaco editor
function ShowAutocompletion(obj) {
// Disable default autocompletion for javascript
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ noLib: true });
// Helper function to return the monaco completion item type of a thing
function getType(thing, isMember) {
isMember = (isMember == undefined) ? (typeof isMember == "boolean") ? isMember : false : false; // Give isMember a default value of false
switch ((typeof thing).toLowerCase()) {
case "object":
@meew0
meew0 / apitosqa.md
Last active December 22, 2022 04:10
API ToS Q&A Summary

This is a summary of the Q&A regarding the new API ToS that took place in the #api channel on the Discord API server, starting around midnight UTC on Thursday, August 17, 2017.

All answers are from b1nzy unless marked otherwise. This is just a summary of my (meew0) own interpretation of the Q&A; obviously this shouldn't be interpreted as anything legally binding. If in doubt, ask the devs yourself or consult a lawyer. I'm not responsible if you get banned or sued because of this document. All subsequent usages of first-person pronouns refer to the people asking/answering the questions, respectively.

Q. How do we detect users deleting their accounts, if we have to delete their data within 7 days?
A. You will get an email by Discord if that happens. Make sure the account that registered the bot application has an email attached to it that you actually get messages with. This may change in the future but if it will, there will be plenty of time before the new mechanism goes into effect.

Q. **Do we need

/**
* Hypertext Transfer Protocol (HTTP) response status codes.
*
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
*/
export enum HttpStatusCode {
/**
* The server has received the request headers and the client should proceed to send the request body
* (in the case of a request for which a body needs to be sent; for example, a POST request).
@bugshake
bugshake / SortedGizmos.cs
Created September 28, 2018 12:27
Depth sorted Gizmos in the Unity Editor
using System;
using System.Collections.Generic;
using UnityEngine;
public static class SortedGizmos
{
static List<ICommand> commands = new List<ICommand>(1000);
public static Color color { get; set; }
# CSharp formatting rules:
[*.cs]
csharp_new_line_before_open_brace = none
csharp_new_line_before_else = false
csharp_new_line_before_catch = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_members_in_anonymous_types = false
csharp_new_line_between_query_expression_clauses = false
@FreyaHolmer
FreyaHolmer / AssetCopyUtils.cs
Last active June 12, 2024 07:25
Adds context menu items to assets: Copy/Paste import settings & Copy GUID. Put this script in any Editor/ folder in your project and recompile!
// written by https://github.com/FreyaHolmer so use at your own risk c:
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
/// <summary>Utility functions to copy GUIDs, as well as Copy/Paste import settings</summary>
public static class AssetCopyUtils {
const int CTX_MENU_LOCATION = 70;