Skip to content

Instantly share code, notes, and snippets.

View ninjayoto's full-sized avatar

ninjayoto

  • Canada
View GitHub Profile
@gillchristian
gillchristian / jq-cheetsheet.md
Last active February 14, 2022 22:30 — forked from olih/jq-cheetsheet.md
jq Chaet Sheet [cheat-sheet]

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@Ravenstine
Ravenstine / aws-couchdb-setup.md
Last active February 18, 2025 03:56
Fast CouchDB setup in AWS

Fast CouchDB setup in AWS

CouchDB is a NoSQL database for storing JSON documents. It comes with a REST API out of the box so your client applications can persist data while requiring you to write little or no server-side code. CouchDB's killer feature is its ability to easily replicate, which allows for horizontal scaling, easy backup, and for client adapters to synchronize documents. This is perfect if you want to write an application that is offline-first. It's become my go-to database when creating new

@jagrosh
jagrosh / Growing A Discord Server.md
Last active November 28, 2025 14:11
Tips for creating and growing a new Discord server

This guide is kept up-to-date as Discord and available resources change!
A basic server template is available here

Creating and Growing a Discord Server

logo

Introduction

Hello! I'm jagrosh#4824! I'm writing this guide to try to help new server owners set up and grow their servers, which is a commonly-requested topic. It's very easy to go about this the wrong way, so it's best to be prepared and make smart decisions so that your community can flourish!

Background

@ziadoz
ziadoz / install.sh
Last active October 4, 2025 06:28
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
@Test
public void postMessage()
{
driver.get("https://csc510-fall16.slack.com/");
// Wait until page loads and we can see a sign in button.
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("signin_btn")));
// Find email and password fields.
@Kirkkt
Kirkkt / array-flattener.js
Last active August 7, 2019 13:48
flatten an array of arbitrarily nested arrays of integers into a flat array of integers
/**
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
Your solution should be a link to a gist on gist.github.com with your implementation.
When writing this code, you can use any language you're comfortable with. The code must be well tested and documented if necessary, and in general please treat the quality of the code as if it was ready to ship to production.
Try to avoid using language defined methods like Ruby's Array#flatten.*
*/
'use strict';
@andymatuschak
andymatuschak / States-v3.md
Last active December 6, 2025 23:58
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@SamuelSchwent
SamuelSchwent / DisplayItems.java
Created March 3, 2016 15:46
Java - Throwing and Handling Exceptions
package Challenge3;
public class DisplayItems {
public static void main(String[] args) throws InvalidUnitsException, InvalidPriceException {
RetailItem item1 = new RetailItem("Jacket", 12, 59.95);
RetailItem item2 = new RetailItem("Designer Jeans", 20, 34.95);
RetailItem item3 = new RetailItem("Shirt", 20, -24.95);
System.out.printf("Item 1: %s\nUnits: %d\nPrice: %.2f\n"
@eightyknots
eightyknots / avregex.md
Last active November 3, 2025 15:45
AvReg: Aviation regex match toolkit

AvReg: The Aviation RegEx Match Toolkit

General Tips

  • The PCRE flavour of RegEx is used here.
  • Append the i modifier to the end of the regex to make any pattern case-insensitive.

Aircraft

| Purpose | Description | RegEx | Example |

<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//