Skip to content

Instantly share code, notes, and snippets.

View char's full-sized avatar
🏳️‍⚧️

charlotte ✨ char

🏳️‍⚧️
View GitHub Profile
@char
char / delta.ts
Last active January 4, 2020 08:07
Git delta parser in pure TypeScript
// A git delta parser in TypeScript for deno
// Author: Anthony Som
// MIT License.
function copy(source, target, targetOffset, sourcePos, length) {
for (let i = 0; i < length; i++) {
target[targetOffset + i] = source[sourcePos + i]
}
}
@char
char / APIKey.ts
Created September 17, 2019 18:43
TypeORM
import crypto from "crypto";
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { User } from "./User";
@Entity()
export class APIKey {
@PrimaryGeneratedColumn()
public id: number;
@Column()
@char
char / insta-pp.py
Created April 6, 2018 13:53
Full size Instagram profile picture fetcher
#!/usr/bin/env python3
import requests
import json
def get_pp_url(username):
api_response = json.loads(requests.get(f"https://instagram.com/{username}/?__a=1").text)
user_id = api_response["graphql"]["user"]["id"]
user_api_response = json.loads(requests.get(f"https://i.instagram.com/api/v1/users/{user_id}/info/").text)
Well, My Little Bronies, I've seen the new My Little Pony theatrical film, and while positive reviews are rolling in,
praising the film's colourful characters and child-friendly message, some of what I saw in the theatre shocked me.
What everypony in this fandom deserves is a rational, in-fandom examination of how this film ties into all of the pre-existing My Little Pony canon.
Beware, everypony! There are spoilers ahead.
While watching this film, I became overwhelmed by the sheer number of glaring oversights and internal inconsistencies in this story.
This film shows a blatant and irresponsible disregard for the pre-established canon of the My Little Pony universe!
The film begins with Princess Twilight Sparkle nervous about the arrival of Songbird Serenade: A singing pop-star pony that is voiced by, and resembles real-life pop-star Sia.
@char
char / 2d-scramble.py
Last active October 3, 2017 10:57
2D array transformation string mangle
from itertools import count
# Count is a convenience method from the standard library's `itertools` module that infinitely yields higher numbers
# It looks cleaner than manually creating a variable and using a while True loop
user_input = None # Initialize the user_input to none
while not user_input: # When user_input's boolean coercion resolves to true, the string is non-empty
user_input = input("Enter your message: ") # We ask the user to enter a message.
array_dimensions = 0
# The array_dimensions variable will hold the width and height of the array -
@char
char / EventBus.java
Created July 17, 2016 20:45
Event Bus in 58 lines of Java
package site.hackery.photon;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import static java.util.Arrays.asList;