Skip to content

Instantly share code, notes, and snippets.

View RyanCCollins's full-sized avatar

Ryan Collins RyanCCollins

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ryanccollins on github.
  • I am rcc_hpe (https://keybase.io/rcc_hpe) on keybase.
  • I have a public key ASBBVTJE18ko6qa6ET0yDAzk9KMf1bnjIBWHikCUIaaeZQo

To claim this, I am signing this object:

@RyanCCollins
RyanCCollins / condaenv.txt
Created December 24, 2018 12:36 — forked from pratos/condaenv.txt
To package a conda environment (Requirement.txt and virtual environment)
# For Windows users# Note: <> denotes changes to be made
#Create a conda environment
conda create --name <environment-name> python=<version:2.7/3.5>
#To create a requirements.txt file:
conda list #Gives you list of packages used for the environment
conda list -e > requirements.txt #Save all the info about packages to your folder
@RyanCCollins
RyanCCollins / student.py
Created December 15, 2018 18:48
Just a code example
class Student:
def __init__(self, name, student_id=332):
self.name = name
self.student_id = student_id
def __str__(self):
return "Student: " + self.name
def get_name_capitalized(self):
return self.name.capitalize()
@RyanCCollins
RyanCCollins / emoji_slots.js
Last active September 16, 2017 18:36
Having some fun on webpackbin
// From https://www.webpackbin.com/bins/-Ku7fYF911w0Y-YUxqVa
import React from 'react'
import { compose, lifecycle, withHandlers, withState, withProps } from 'recompose'
import styled, { css } from 'styled-components'
import { range, sample } from 'lodash'
const Screen = styled.main`
height: 200vh;
`
@RyanCCollins
RyanCCollins / gist:7ca4062a270514d8d2080633a066e60b
Last active September 14, 2017 00:16
Translate react-desc types to typescript definitions
// Start of a utility for translating react-desc types to TypeScript definitions
// https://www.webpackbin.com/bins/-Ktxj9FtGKCYnA9o_C1_
import * as fp from 'lodash/fp';
const PropTypes = {
string: 'string',
func: 'Function',
oneOf: x => x.join('" | "'),
shape: x => JSON.stringify(x),
oneOfType: x => x.join(' | '),
@RyanCCollins
RyanCCollins / keys.js
Last active July 4, 2017 16:52
react keys
// this is no good because other lists in your app could have the same index
{items.map((item, index) =>
<div key={index}>
// ...
</div>
)}
// This is much better since it will most likely be unique
{items.map((item, index) =>
<div key={`${item.title}-${index}`}>
@RyanCCollins
RyanCCollins / currying.swift
Last active June 30, 2017 07:00
Swift currying
func curried(_ f: @escaping (_: Int, _: Int) -> Int) -> (_: Int) -> (_: Int) -> Int {
return { a in { b in f(a, b) }}
}
@RyanCCollins
RyanCCollins / iife.js
Created June 28, 2017 00:23
Switch in IIFE
function IconPicker({ type }) {
<div>
{(() => {
switch(type) {
case 'Foo':
return <Foo />;
case 'Bar':
return <Bar />;
}
})()}
@RyanCCollins
RyanCCollins / object-destructuring.js
Created June 27, 2017 20:21
Object destructuring example:
// Using object de-structuring
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
const albumSalesStrings = musicData.map(
({ album, artist, sales }) => `${album} by ${artist} sold ${sales} copies`
);
@RyanCCollins
RyanCCollins / dcgan-output.py
Created May 27, 2017 01:25
MNIST DCGAN Output
Epoch 1/2... Discriminator Loss: 2.9822... Generator Loss: 0.0750
Epoch 1/2... Discriminator Loss: 1.7655... Generator Loss: 0.9984
Epoch 1/2... Discriminator Loss: 2.0640... Generator Loss: 0.2003
Epoch 1/2... Discriminator Loss: 0.5469... Generator Loss: 2.2514
Epoch 1/2... Discriminator Loss: 0.5017... Generator Loss: 3.0328
Epoch 1/2... Discriminator Loss: 1.5120... Generator Loss: 0.4518
Epoch 1/2... Discriminator Loss: 0.4125... Generator Loss: 3.2917
Epoch 1/2... Discriminator Loss: 0.4879... Generator Loss: 2.2174
Epoch 1/2... Discriminator Loss: 2.3055... Generator Loss: 5.8401