Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Houhoulis houhoulis

  • Boston, Massachusetts, U.S.
View GitHub Profile
@houhoulis
houhoulis / trash_image_capture_dupes.rb
Created Sep 26, 2020
Find dupes that Apple's "Image Capture.app" is creating when importing photos from my camera, & move to trash. Compare dupes to the previous dupe (or original) via md5.
View trash_image_capture_dupes.rb
require 'digest'
def filenames
Dir.entries('.').sort
end
def digest filename
Digest::MD5.hexdigest File.read(filename)
end
View weekly_release.py
#!/usr/local/bin/python3
import requests
import json
from twilio.rest import Client
HEADERS = {'Accept': 'application/vnd.github.inertia-preview+json'}
GH_TOKEN = "XXX" # Your auth token from https://github.com/settings/tokens
TW_SID = "XXX" # Your Account SID from twilio.com/console
TW_TOKEN = "XXX" # Your Auth Token from twilio.com/console
@houhoulis
houhoulis / cities.json
Created Jun 1, 2020 — forked from Miserlou/cities.json
1000 Largest US Cities By Population With Geographic Coordinates, in JSON
View cities.json
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
@houhoulis
houhoulis / methods.md
Last active Apr 30, 2018
How define a method with a default argument of `nil` that can detect whether `nil` or no argument was passed in?
View methods.md

How define a method which takes an optional argument w/ a default value, but you have to distinguish whether the default arg or no arg was passed in?

class Foo
  def bar(a = "whatevs")
    # Was "whatevs" passed in, or no arg?
  end
end

Two very different examples that distinguish between nil and no arg:

@houhoulis
houhoulis / settings.js
Last active Oct 13, 2018
ms vs code customizations
View settings.js
{
"[rust]": {
"editor.tabSize": 4,
"editor.insertSpaces": true
},
"bracketPairColorizer.forceUniqueOpeningColor": false,
"bracketPairColorizer.forceIterationColorCycle": false,
"bracketPairColorizer.colorMode": "Consecutive",
//"bracketPairColorizer.scopeLineCSS": ["{color}"],
@houhoulis
houhoulis / requirements_spec.rb
Created Mar 7, 2018
hypothetical feature spec for displaying auto-assign field in `spec/features/requirements_spec.rb`
View requirements_spec.rb
require 'rails_helper'
RSpec.describe "Requirements" do
# ... skipping over what's already in this file....
describe "requirement index page" do
it "renders auto_assign field" do
event = create :event
task = create :task, event: event
@houhoulis
houhoulis / open_grapher.html
Created Mar 23, 2017
Highchart graph from URL search parameters
View open_grapher.html
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<body>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container"></div>
<script>
You can’t perform that action at this time.