Skip to content

Instantly share code, notes, and snippets.

View JEphron's full-sized avatar

Jordan Ephron JEphron

  • here and there
View GitHub Profile
@JEphron
JEphron / .gitconfig
Created March 22, 2022 02:35
A few gitconfig aliases
[alias]
ci = commit
co = checkout
st = status
br = branch
di = diff
dis = diff --staged
co = "! sh -c 'if [ -n \"$1\" ]; then git checkout \"$@\"; else git checkout $(git bl | fzf | cut -d \" \" -f 2); fi;' -"
bl = -p for-each-ref --sort=-committerdate refs/heads/ --format='%(color: yellow)%(committerdate:short) %(color: white)%(refname:short)'
def get_json_from_bucket(bucket_name, item_name):
s3 = boto3.resource('s3')
output = StringIO.StringIO()
try:
s3.Bucket(bucket_name).download_fileobj(item_name, output)
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] == '404':
print('The object does not exist.')
else:
@JEphron
JEphron / CoroutineExample.kt
Created January 7, 2018 17:53
Kotlin Processing Coroutines
import processing.core.PVector
class CoroutineExample : CoroutineApp() {
data class Ellipse(var position: PVector, var color: Int, var width: Float = 20f, var height: Float = 20f)
private var backgroundColor = color(128f)
private val ellipses = mutableListOf<Ellipse>()
override fun settings() {
size(500, 500)
{
"type": "object",
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"weight": {
@JEphron
JEphron / CatmullRom2D.cs
Last active March 23, 2024 03:48
Catmull-Rom Spline Implementation
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Encapsulates a Catmull Rom spline path
/// </summary>
/// todo: consider implementing the Centripedal Catmull Rom variation
public class CatmullRom2D
{
@JEphron
JEphron / rule30.hs
Last active December 16, 2016 23:23
Rule 30
import Data.Maybe
import Data.List
import Data.Bits (bit, (.&.))
import Data.Map (fromList, (!))
import Control.Monad
import Graphics.Gloss
data Cell = Alive | Dead deriving (Eq, Ord)
instance Show Cell where
@JEphron
JEphron / Maybe.cs
Last active December 29, 2016 22:27
C# Option Types
using System;
namespace JME.Option
{
public class Maybe<T>
{
private readonly T _t;
private readonly bool _isSome;
public Maybe(T t)
[RPBroadcastActivityViewController loadBroadcastActivityViewControllerWithHandler:^(RPBroadcastActivityViewController *broadcastActivityViewController, NSError *error) {
broadcastActivityViewController.delegate = self;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
broadcastActivityViewController.modalPresentationStyle = UIModalPresentationPopover;
broadcastActivityViewController.popoverPresentationController.sourceRect = _broadcastButton.frame;
broadcastActivityViewController.popoverPresentationController.sourceView = _broadcastButton;
}
set-alias subl "C:\Program Files\Sublime Text 3\subl"
set-alias touch new-item
set-alias o explorer
set-alias ghub Github
set-alias gh Github
git config --global alias.lg "log --graph --abbrev-commit --decorate --format=format:'%C(bold white)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"
git config --global alias.co checkout
git config --global alias.di diff
git config --global alias.br branch
git config --global alias.ci commit
@JEphron
JEphron / rc.txt
Created April 19, 2016 02:30
Open Github
alias github='open `git remote show origin | grep Fetch | sed -e '"'"'s/Fetch URL: //'"'"' -e '"'"'s/\.git//'"'"'`'