Skip to content

Instantly share code, notes, and snippets.

View dcrockwell's full-sized avatar
💼
Seeking new opportunities

D. C. Rockwell dcrockwell

💼
Seeking new opportunities
View GitHub Profile

Keybase proof

I hereby claim:

  • I am dcrockwell on github.
  • I am dcrockwell (https://keybase.io/dcrockwell) on keybase.
  • I have a public key ASDgqaWFwf4Nmrst-uGHanLpdoionoW7MkWiD4NZ-CcTXAo

To claim this, I am signing this object:

@dcrockwell
dcrockwell / 36.valid_sudoku.js
Created March 3, 2020 03:00
LeetCode 36: Valid Sudoku
/**
* @param {character[][]} board
* @return {boolean}
*/
function isValidSudoku (board) {
let isValid = true;
const rowsAreValid = board.every((row) => isValidSudokuSet(row));
if (!rowsAreValid) { return false; }
@dcrockwell
dcrockwell / 1046.last_stone_weight.rb
Created March 2, 2020 04:43
LeetCode 1046: Last Stone Weight
# @param {Integer[]} stones
# @return {Integer}
def last_stone_weight(stones)
stones.sort!
until stones.length < 2
stone_a, stone_b = stones.pop(2)
if stone_a != stone_b
stone_c = stone_b - stone_a
@dcrockwell
dcrockwell / 695.max_area_of_island.rb
Created March 1, 2020 19:49
695. Max Area of Island
# https://leetcode.com/problems/max-area-of-island/
# @param {Integer[][]} grid
# @return {Integer}
def max_area_of_island(grid)
largest_island_area = 0
cells_seen = []
grid.each_with_index do |row, row_index|
@dcrockwell
dcrockwell / palindromic_substring_count.rb
Last active February 29, 2020 06:03
LeetCode 647. Palindromic Substrings
# @param {String} string
# @return {Integer}
def palindromic_substring_count(string)
palindrome_count = 0
string.length.times do |start_index|
string.length.times do |end_index|
next unless start_index <= end_index
substring = string[start_index..end_index]
@dcrockwell
dcrockwell / currentApplication.js
Created September 2, 2016 02:50
Reliable frontmost application via JXA
const currentApplication = a.applicationProcesses.where({
frontmost: true
})[0];
@dcrockwell
dcrockwell / dog.spec.js
Created August 17, 2016 22:01
Dog Spec
class Dog {
constructor() {
this.position = 0;
this.status = "healthy";
}
walk(distance) {
this.position += distance;
}
@dcrockwell
dcrockwell / ariPrimes.rb
Created July 30, 2016 18:46
Ari Primes Ruby Solution
2.upto(100){|i|if/^(.{2,})\1+$/.match("x"*(i))==nil;puts i;end}
@dcrockwell
dcrockwell / killUser.sh
Created July 30, 2016 04:07
Kill all processes by user
kill -9 `ps -aux | grep {user} | awk '{print $2}'`
@dcrockwell
dcrockwell / .bash_profile
Last active July 26, 2016 10:41
Open CodinGame in a bare Chrome window
codingame() {
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app=https://codingame.com
}