Skip to content

Instantly share code, notes, and snippets.

Zach Schneider schneidmaster

Block or report user

Report or block schneidmaster

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View array.md
@schneidmaster
schneidmaster / react.d.ts
Last active Oct 31, 2018
Typescript definitions for React hooks
View react.d.ts
// Typescript definitions for React hooks
// Take with a grain of salt; these are a first attempt and I've only actually
// used a few so far :)
import { Context, RefObject } from 'react';
declare module 'react' {
export function useState<T>(initialValue: T): [T, (newState: T) => void];
export function useEffect(effect: Function, inputs?: Array<any>): void;
export function useMutationEffect(effect: Function, inputs?: Array<any>): void;
@schneidmaster
schneidmaster / 1-useState.js
Last active Oct 29, 2018
React Conf 2018 -- new functional component APIs https://reactjs.org/docs/hooks-intro.html
View 1-useState.js
// Basic example of useState.
import React, { useState } from 'react';
export default function Greeting(props) {
const [name, setName] = useState('Mary');
function handleNameChange(e) {
setName(e.target.value);
}
@schneidmaster
schneidmaster / setup.sh
Last active Aug 30, 2018
Environment Setup
View setup.sh
# Sets up basic development environment for ruby and nodejs
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Homebrew basics
brew install adns apr apr-util archey aspell atk augeas autoconf automake aws-cfn-tools aws-elasticbeanstalk awscli boost cairo certbot clamav cmake convox coreutils dialog dos2unix doxygen ec2-api-tools elasticsearch erlang faac ffmpeg flow fontconfig freetds freetype gcc gd gdbm gettext gifsicle git glew glib gmp gnupg gnupg2 gnutls go gobject-introspection gource graphviz heroku htop htop-osx hub icu4c imagemagick isl jhead jpeg jpegoptim lame libassuan libevent libffi libgcrypt libgpg-error libidn2 libksba libmpc libpng libpq libtasn1 libtiff libtool libunistring libusb libusb-compat libvo-aacenc libxml2 libyaml libzip mcrypt memcached mhash mpfr mysql nettle node npth nvm openssl optipng overmind p11-kit pcre pgcli phantomjs php pinentry pinentry-mac pixman pkg-config prettyping pth python python3 python@2 qt r
View gilded_rose.rb
ITEM_AGED_BRIE = "Aged Brie".freeze
ITEM_BACKSTAGE_PASS = "Backstage passes to a TAFKAL80ETC concert".freeze
ITEM_SULFURAS = "Sulfuras, Hand of Ragnaros".freeze
class GildedRose
def initialize(items)
@items = items
end
def update_quality()
@schneidmaster
schneidmaster / .tool-versions
Last active Jan 19, 2018
Elixir/Phoenix + CircleCI config
View .tool-versions
erlang 18.0
elixir 1.3.2
View disks.rb
# Problem: https://twitter.com/AtticusGF/status/935977894651691008
#
# Stage 1 has 7 disks
# Stage 2 has 16 disks (or 7 + 3^2)
# Stage 3 has 41 disks (or 16 + 5^2)
# Stage 4 has 90 disks (or 41 + 7^2)
# so for each stage, add the incrementor squared and then
# increase the incrementor by 2
# Print off every million to avoid wasting too much
# time with terminal output
@schneidmaster
schneidmaster / MaskedInput.js
Created Jan 28, 2016
react-bootstrap + react-maskedinput
View MaskedInput.js
import React from 'react';
import classNames from 'classnames';
import { Input } from 'react-bootstrap';
import MaskedInputField from 'react-maskedinput';
export default class MaskedInput extends Input {
renderInput() {
const className = this.isCheckboxOrRadio() || this.isFile() ? '' : 'form-control';
return <MaskedInputField {...this.props} className={classNames(this.props.className, className)} ref="input" key="input" />;
}
@schneidmaster
schneidmaster / SimpleHTTPServer.cs
Created Sep 23, 2015
Simple C# Webserver for Aha! access token
View SimpleHTTPServer.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Threading;
using System.Diagnostics;
@schneidmaster
schneidmaster / policy.json
Created Dec 17, 2015
S3 policy to allow full access to a bucket
View policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": "arn:aws:s3:::BUCKET_NAME"
You can’t perform that action at this time.