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);
}
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()
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 / .tool-versions
Last active Jan 19, 2018
Elixir/Phoenix + CircleCI config
View .tool-versions
erlang 18.0
elixir 1.3.2
@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 / 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"
@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;
View gist:9e94ed793e12e9073397
Verifying I am +schneidmaster on my passcard. https://onename.com/schneidmaster
You can’t perform that action at this time.