Here is a GraphQL query to fetch my repositories
{
user(login: "Mattamorphic") {
repositories(first: 2) {
edges {
cursor
node {
name
def unzip_file(self, path): | |
''' | |
Using a file path, unzip the file in to a directory of files returning a list of files in that folder | |
:param path, a string representing the location of the zip file (path/to/zip.zip) | |
:rtype list of files in decompressed folder | |
''' | |
import os | |
import zipfile | |
folder, ext = os.path.splitext(path) | |
if not os.path.exists(folder): |
<?php | |
Class CSVHandle | |
{ | |
const CHUNK_SIZE = 4096; | |
private $chunk = []; | |
private $buffer = ''; | |
private $fp = null; | |
/** |
<?php | |
/** | |
* Perform an STRIPOS with multiple needles, and optionally filter the result to a bool | |
* @param string $haystack The string to search | |
* @param array $needles The array of needles to hunt for | |
* @param int $offset The offset to start at | |
* @param bool $filter Should we filter the result to a boolean? | |
* | |
* @return mixed |
<?php | |
/** | |
* This is tested in PHP 7.1 | |
* As part of a system I'm looking to store a series of hashes, and look these up. | |
* There could be many hashes, and I don't need to use these, I just need to know if they exist. | |
* | |
* The following tests pit arrays against strings to see which is the fastest. | |
* I'll be searching for MTIzNDY5MTI1Njc4 which is the number 12345678 * 1000 base 64 encoded | |
**/ |
# /bin/python3 | |
import itertools # we'll need the unique combinations of multiples | |
''' | |
Calculate the sum of all multiples in a given total | |
Divide total by multiples to get the amount of multiples. | |
Then multiply this by the total plus the multiple and divie the result | |
by 2 | |
:param int multiple The multiples to search for |
Here is a GraphQL query to fetch my repositories
{
user(login: "Mattamorphic") {
repositories(first: 2) {
edges {
cursor
node {
name
plugins { | |
// Apply the java plugin to add support for Java | |
id 'java' | |
// Apply the application plugin to add support for building a CLI application | |
id 'application' | |
id 'maven-publish' | |
} | |
repositories { |
name: Deploy package to GitHub package registry | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
jobs: | |
build: |
export enum AccountType { | |
USER = 'User', | |
ORGANIZATION = 'Organization' | |
} | |
export interface Account { | |
login: string; | |
id: number; | |
node_id: string; | |
avatar_url: string; |
# Given f(x) = x**4 - 3**3 + 2 = f1(x) = 4x**3 - 9**2 | |
# lets start at x = 6 | |
curr_x = 6 | |
gamma = 0.001 | |
precision = 0.0000001 | |
step_size = 1 | |
max_iterations = 1000 | |
i = 0 | |
df = lambda x: (4 * x**3) - (9**2) |