Skip to content

Instantly share code, notes, and snippets.

View edwardkenfox's full-sized avatar
🎯
Focusing

Edward Fox edwardkenfox

🎯
Focusing
View GitHub Profile
@edwardkenfox
edwardkenfox / Gemfile
Last active January 24, 2024 08:18
PSI collector
# frozen_string_literal: true
source "https://rubygems.org"
# gem "rails"
gem "faraday"
@edwardkenfox
edwardkenfox / Gemfile
Created October 21, 2019 05:34
site crawler that summarizes the id & class used in the given URLs
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
gem "pry"
gem "nokogiri"
@edwardkenfox
edwardkenfox / tm.sh
Created January 25, 2019 00:45
Termnial notifier
tm () {
terminal-notifier -title 'Task completed' -message 'All done, sir!' | say Task completed
}
@edwardkenfox
edwardkenfox / bookmarklet.js
Created November 30, 2018 10:59
Bookmarklet that copies trello card title and link in markdown format
javascript:(function(){ var title = document.querySelector('.js-card-detail-title-input').value; var link = location.href.match(/https\:\/\/trello\.com\/c\/(\d|[A-z]){6,10}\//)[0]; var text = `[${title}](${link})` ; var b=document.createElement("textarea"), c=document.getSelection(); b.textContent=text, document.body.appendChild(b), c.removeAllRanges(), b.select(), document.execCommand("copy"), c.removeAllRanges(), document.body.removeChild(b); }());
@edwardkenfox
edwardkenfox / tree.rb
Last active September 26, 2018 01:16
algebra set computation using tree structure
class Tree
attr_accessor :root
def initialize(root)
@root = root
end
def insert(parent, left, right)
parent.left = left
parent.right = right
@edwardkenfox
edwardkenfox / script.js
Last active October 12, 2018 02:37
private method in JavaScript using Symbols
const obj = (() => {
const privateName = Symbol('privateName')
return {
[privateName]() {
return 'Foo'
},
publicName() {
return `${this[privateName]()} Bar`
}
}
@edwardkenfox
edwardkenfox / script.rb
Created July 17, 2018 11:10
slack teamのactiveなアカウントの画像をDLしてくれる君
require "slack"
require 'open-uri'
YOUR_SLACK_APP_OAUTH_TOKEN = ENV['YOUR_SLACK_APP_OAUTH_TOKEN']
Slack.configure do |config|
config.token = YOUR_SLACK_APP_OAUTH_TOKEN
end
members = Slack.users_list["members"].select { |m| !m["deleted"] }
@edwardkenfox
edwardkenfox / index.html
Created June 5, 2018 07:30
switch UI sample
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div class="switch-container">
<input type="checkbox" id="switch">
<label class="switch-area" for="switch">
<div class="off"><span class="off-span">OFF</span></div>
<div class="on"><span class="on-span">ON</span></div>
sendBeacon attempt 0 with 0 bytes succeeded
...
sendBeacon attempt 362 with 65703 bytes succeeded
sendBeacon attempt 363 with 65703 bytes failed
@edwardkenfox
edwardkenfox / gh_copy_bookmarklet.js
Created May 15, 2018 22:26
Copy GitHub PR title and link in markdown format
javascript:(function(){ var title = document.querySelector('.js-issue-title').innerText; var prNum = document.querySelector('.gh-header-number').innerText; var link = location.href.split('#')[0]; var text = `${title} [${prNum}](${location.href.split('#')[0]})` ; var b=document.createElement("textarea"), c=document.getSelection(); b.textContent=text, document.body.appendChild(b), c.removeAllRanges(), b.select(), document.execCommand("copy"), c.removeAllRanges(), document.body.removeChild(b); }());