Skip to content

Instantly share code, notes, and snippets.

View R167's full-sized avatar
⚙️

Winston Durand R167

⚙️
View GitHub Profile
@R167
R167 / flip-flop-relative-time.js
Created April 23, 2023 19:43
Bookmarklet to flip-flop GitHub's `relative-time` tag to use `format="datetime"`
javascript:(()=>{
const relativeTimes = document.querySelectorAll('relative-time[format="relative"], relative-time:not([format])');
if (relativeTimes.length > 0) {
for (let elem of relativeTimes) {
elem.setAttribute('data-old-config', JSON.stringify({
format: elem.getAttribute('format'),
hour: elem.getAttribute('hour'),
minute: elem.getAttribute('minute')
}));
elem.setAttribute('format', 'datetime');
@R167
R167 / CODING_GUIDE.md
Last active May 24, 2022 16:10
A good reference coding guide

We Heart It Ruby Coding Guide

Overall Principals (in order of importance)

  1. Two spaces to indent. Be anal about this.
  2. Write code in English.
  3. Code must work.
  4. Code must be easy to understand.
  5. Critical code should be efficient.
  6. Use standardrb, a minimal, opinionated ruby formatter with a sane default config. Make sure everyone is using it from the beginning.
@R167
R167 / main.go
Created March 22, 2022 05:50
Test golang bookmarks SDK
package main
import (
"fmt"
"encoding/json"
"github.com/slack-go/slack"
)
@R167
R167 / process.rb
Created April 28, 2017 13:44
For AP Bio
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'csv'
MATCHER = /\Adata\/(?<deg>\d+)\/(?<bug>L\d)\.txt\z/.freeze
files = Hash.new { |h, k| h[k] = Hash.new }
Dir['data/*/*.txt'].each do |s|
function diagnolWinner() {
var color;
for (var i = 0; i <= board.length - 4; i++) {
if ((color = genericDiagnol(i, 1)) !== 0) {
return color;
}
}
for (var i = board.length - 1; i >= board.length - 4; i--) {
if ((color = genericDiagnol(i, -1)) !== 0) {
return color;

Keybase proof

I hereby claim:

  • I am R167 on github.
  • I am wmdurand (https://keybase.io/wmdurand) on keybase.
  • I have a public key whose fingerprint is 4A38 5B71 4B0A FA8E 6CC1 8BFF D157 8D5F 36A8 6B41

To claim this, I am signing this object:

@R167
R167 / car.java
Created April 14, 2016 21:52
AP CS assignment
public class Car extends SteeringVehicle {
// write all methods required
}
<!DOCTYPE html>
<!--
- Full screen clock (24-hour with seconds)
- Copyright (c) 2015 Project Nayuki
-
- http://www.nayuki.io/page/full-screen-clock-javascript
-->
<html style="display:block; height:100%; margin:0; padding:0">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
@R167
R167 / copyEndy.java
Last active August 29, 2015 14:15
Coding Bats
// AP-1 => copyEndy
// passed
public int[] copyEndy(int[] nums, int count) {
int[] ret = new int[count];
int curr = 0;
for (int i = 0; i < nums.length && curr < count; i++) {
if ((nums[i] <= 10 && nums[i] >= 0) || (nums[i] <= 100 && nums[i] >= 90)) {
ret[curr] = nums[i];
curr += 1;