Skip to content

Instantly share code, notes, and snippets.

View dylanerichards's full-sized avatar

Dylan Richards dylanerichards

View GitHub Profile
IFS=$'\n' ; for x in $(git shortlog -sne | cut -f2 -d$'\t' | sed -e 's/ <.*//' | sort | uniq); do echo $x; git log --since '2 weeks ago' --author="$x" -p | grep '^[+-][^+-]' | wc | cut -c1-8 ; done
@dylanerichards
dylanerichards / .tmux.conf
Created October 21, 2020 14:33
.tmux.conf
# Prefix
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Mouse scrolling
set-option -g mouse on
# make scrolling with wheels work
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
execute pathogen#infect()
call pathogen#helptags()
syntax enable
set background=light
colorscheme solarized
set guifont="Inconsolata"
set smartindent
ENV["SINATRA_ENV"] ||= "development"
require_relative './config/environment'
require 'sinatra/activerecord/rake'
require 'active_support/duration'
namespace :medicine do
task :send_reminders do
twilio_account_sid = "AC4bf52c17125e47be385b764e50474a64"
twilio_auth_token = "0231a729464dedc96dd783b0a39c9ba8"
var header = document.getElementById("header")
var button = document.getElementById("login-button")
button.addEventListener("click", function() {
validateForm()
})
function validateForm() {
if(checkPassword() == true && checkUsername() == true) {
def find(id)
cmd = `sqlite3 test "select * from things where id = #{id}"`
end
def all
users_array = []
users = `sqlite3 test "select * from things;"`.split("\n")
users.each { |user| users_array << user }
@dylanerichards
dylanerichards / problem-1.js
Last active September 28, 2016 20:36
JS Code Challenges
function stringy(num) {
var result = [1];
if (num == 1) { return result; };
for(i = 0; i < num; i++) {
var lastElement = result[result.length - 1];
lastElement == 0 ? result.push(1) : result.push(0);
}
@dylanerichards
dylanerichards / git.sh
Created September 8, 2016 20:32
Making a repo
➜ new-repository git init
Initialized empty Git repository in /Users/dylanrichards/code/new-repository/.git/
➜ new-repository git:(master) touch index.html
➜ new-repository git:(master) ✗ gd
➜ new-repository git:(master) ✗ gaa
On branch master
Initial commit
Changes to be committed:
class WakaWaka
attr_reader :code
def initialize(code)
@code = code
end
MAPPINGS = {
'<' => 'Waka',
'>' => 'waka',
class NumberGuessingGame
def initialize
p @number = rand(0..9).to_s
end
def guess
puts "I'm thinking of a random number from 0 to 9"
puts "Can you guess it?"
input = gets.chomp