Skip to content

Instantly share code, notes, and snippets.

@jch
jch / slideshow_controller.js
Created March 23, 2023 20:56
Stimulus slideshow controller, because I'm too stupid to do modulo math
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = [ "slide" ]
initialize() {
this.index = 1
}
next(e) {

Installation

1)

brew install nginx
sudo cp /usr/local/Cellar/nginx/1.8.0/homebrew.mxcl.nginx.plist /Library/LaunchDaemons

2)

Replace /usr/local/etc/nginx/nginx.conf with the nginx.conf in this gist. I'm using port 8888 for my current project. Obviously, change server_name as well, and probably the name of its access log.

@jch
jch / mint.rb
Created December 29, 2016 17:38
# Clean up Mint exported transactions for working with a spreadsheet
#
# Usage:
#
# ruby mint.rb <transactions.csv>
#
# Export a CSV of transactions from Mint
#
# Tags are not exported, so it must be filtered out before export:
#
Last login: Tue Aug 23 13:16:58 on ttys003
jch@Jerrys-MacBook-Pro:~$ cd projects/ruby-net-ldap/
jch@Jerrys-MacBook-Pro:~/projects/ruby-net-ldap[tls-verify-hostnames]$ cd test/support/vm/openldap
jch@Jerrys-MacBook-Pro:~/projects/ruby-net-ldap/test/support/vm/openldap[tls-verify-hostnames]$ vagrant destroy
==> default: VM not created. Moving on...
jch@Jerrys-MacBook-Pro:~/projects/ruby-net-ldap/test/support/vm/openldap[tls-verify-hostnames]$ gem uninstall vagrant
jch@Jerrys-MacBook-Pro:~/projects/ruby-net-ldap/test/support/vm/openldap[tls-verify-hostnames]$ rbenv rehash
jch@Jerrys-MacBook-Pro:~/projects/ruby-net-ldap/test/support/vm/openldap[tls-verify-hostnames]$ hash -r
jch@Jerrys-MacBook-Pro:~/projects/ruby-net-ldap/test/support/vm/openldap[tls-verify-hostnames]$ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'hashicorp/precise64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'hashicorp/precise64' is up to date...
==> default: Setting the name of the VM: openldap_default_1471972387230_9628
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
require 'rack'
# Track changes in rack requests and responses made by middleware.
#
# SomeMiddleware
# request: ...
# response: ...
# AnotherMiddleware
# request: ...
# response: ...
# Proposal for mapping responses back to requests for Net::LDAP.
require "fiber"
module Net
module LDAP
class Connection
# Hash of Responses keyed by message_id
attr_reader :responses
# Fake socket to read/write from
  • Kabana Restaurant - 1106 University Ave. Berkeley, CA 94702
  • Taste of the Himalayas - 1700 Shattuck Ave.Ste. A Berkeley, CA 94709
  • Brazil Cafe - 1960 University Ave Berkeley, CA 94704
  • Arabica Restaurant Mediterranean Cuisine - 2115 Kittredge St Berkeley, CA 94704
  • Claremont Diner - 6200 Claremont Ave. Oakland, CA 94618
  • Miss Saigon Vietnamese Restaurant - 3345 Grand Ave. Oakland, CA 94610
  • Siam Orchid Thai Restaurant - 23-H Orinda Way Orinda, CA 94563
  • Holy Land Restaurant - 677 Rand Ave. Oakland, CA 94610
  • Lazeeza Pakistani & Indian Cruise - 10 Hegenberger Rd Oakland, CA 94621
  • Saroor Indian Cuisine - 2580 N. Main St. Walnut Creek, CA 94596
@jch
jch / messages-clean.md
Last active August 29, 2015 14:06
How to clean up your Mac Messages contact list
  • Delete Google Plus profile - stops the syncing of circles and friends
  • Revert to old Google Talk
  • Unlink Google account from System Preferences -> Internet Accounts
  • Clean up contacts in http://contacts.google.com
  • Open messages, select all, remove
  • Remove Messages related plists
  • Re-add Google account to Internet Accounts
  • Open Apple Contacts - this should now pull down a clean list of your contacts
  • Open Messages
  • Open GMail, from the chat, message the contacts you want to show up in Messages. This will send an invite to Messages that you can accept

Keybase proof

I hereby claim:

  • I am jch on github.
  • I am jch (https://keybase.io/jch) on keybase.
  • I have a public key whose fingerprint is FAE8 17C4 6934 9DB4 8B49 FE0B 7374 4527 759B EE9C

To claim this, I am signing this object: