Skip to content

Instantly share code, notes, and snippets.

@bshyong
bshyong / broadcast-channel.md
Created November 27, 2023 01:11 — forked from davestewart/broadcast-channel.md
Example of using BroadcastChannel to communicate with pages in the same domain

screenshot

Keybase proof

I hereby claim:

  • I am bshyong on github.
  • I am bshyong (https://keybase.io/bshyong) on keybase.
  • I have a public key ASBaKNlRicQO1-VBcEz5XZ8220YDdrNB0W8vnxRYPBldowo

To claim this, I am signing this object:

@bshyong
bshyong / Notes.md
Created November 24, 2015 02:57
Getting npm install to work on AWS Elastic Beanstalk
  1. Disable normal asset compilation
  2. Make sure npm is updated to 3.5.0
  3. Add commands to make sure #2 is done before app code is deployed
  4. Use container commands to do npm install and precompile assets
  commands:
  00_update_npm:
    command: "sh /tmp/install_node_npm.sh"
@bshyong
bshyong / sidekiq_cl.md
Last active August 29, 2015 14:23
sidekiq changelog
@bshyong
bshyong / bitcoin.md
Created June 25, 2015 20:14
bitcoinChangelog
@bshyong
bshyong / marks.json
Created December 20, 2014 05:39
stemmed tags
{
"wp platform": [
"wp-platform"
],
"mobil": [
"mobile",
"Mobile"
],
"go": [
"go"
@bshyong
bshyong / wiki_description.rb
Last active October 17, 2015 03:05
Quick scraper to fetch first paragraph of Wikipedia for a list of topics
require 'open-uri'
require 'nokogiri'
require 'csv'
require 'cgi'
# BASE_URL = 'http://en.wikipedia.org/w/api.php?format=json&action=query&prop=revisions&rvprop=content&titles='
BASE_URL = 'http://en.wikipedia.org/wiki/'
while($input_filename.nil?)
puts "Enter input filename (should be a CSV)"
@bshyong
bshyong / python_bst.py
Last active March 11, 2021 23:09
Python BST implementation
class BSTnode(object):
"""
Representation of a node in a binary search tree.
Has a left child, right child, and key value, and stores its subtree size.
"""
def __init__(self, parent, t):
"""Create a new leaf with key t."""
self.key = t
self.parent = parent
self.left = None
@bshyong
bshyong / gist:6257817
Last active December 21, 2015 05:38
Bash script to pull Heroku DB to local environment - note that this creates a manual backup via heroku pgbackups:capture
#!/bin/bash
# call command with bash pull_production_to_local
function LastBackupName () {
heroku pgbackups --app APPNAME | tail -n 1 | cut -d " " -f 1
}
heroku pgbackups:capture --expire --app APPNAME
new_backup=$(LastBackupName)
@bshyong
bshyong / application.yml
Created July 15, 2013 14:21
Default application.yml file for storing credentials and API keys.
# Add account credentials and API keys here.
# See http://railsapps.github.io/rails-environment-variables.html
# This file should be listed in .gitignore to keep your settings secret!
# Each entry sets a local environment variable and overrides ENV variables in the Unix shell.
# For example, setting:
# GMAIL_USERNAME: Your_Gmail_Username
# makes 'Your_Gmail_Username' available as ENV["GMAIL_USERNAME"]
# Add application configuration variables here, as shown below.
#
SENDGRID_USERNAME: Your_Username