Skip to content

Instantly share code, notes, and snippets.

View ScottRadcliff's full-sized avatar
💭
Is this necessary?

Scott Radcliff ScottRadcliff

💭
Is this necessary?
View GitHub Profile
@ScottRadcliff
ScottRadcliff / signature.exs
Last active April 20, 2019 15:54
Values in signature
defmodule Sample.Signature do
def match(1), do: IO.puts "Matched 1"
def match(2), do: IO.puts "Matched 2"
def match(number), do: IO.puts "Matched #{number} dynamically"
end
# iex "signature.exs"
# Sample.Signature.match(1)
# Matched 1
# :ok
@ScottRadcliff
ScottRadcliff / advent_of_code_day_2017_day_2.rb
Created December 2, 2017 20:43
Day two of Advent of Code 2017
# Day 2: Corruption Checksum
# https://adventofcode.com/2017/day/2
rows =[
[493,458,321,120,49,432,433,92,54,452,41,461,388,409,263,58],
[961,98,518,188,958,114,1044,881,948,590,972,398,115,116,451,492],
[76,783,709,489,617,72,824,452,748,737,691,90,94,77,84,756],
[204,217,90,335,220,127,302,205,242,202,259,110,118,111,200,112],
[249,679,4015,106,3358,1642,228,4559,307,193,4407,3984,3546,2635,3858,924],
[1151,1060,2002,168,3635,3515,3158,141,4009,3725,996,142,3672,153,134,1438],
@ScottRadcliff
ScottRadcliff / nginx.conf
Created April 10, 2017 03:36 — forked from mjumbewu/nginx.conf
Simple SSL-enabled nginx config to serve static files
server {
listen 80;
return 301 https://\$host\$request_uri;
}
server {
listen 443 ssl;
ssl_certificate [PATH_TO_SSL_CERT];
ssl_certificate_key [PATH_TO_SSL_CERT_KEY];
@ScottRadcliff
ScottRadcliff / rsync_jekyll
Created August 28, 2016 18:41
Sync Jekyll site to server
# This will sync the compiled HTML files to a remote install of a jekyll site
# -v verbose
# -r recursive
# -u update
rsync _site -vru [ssh host]:[dir]
# Download nginx startup script
wget -O init-deb.sh https://www.linode.com/docs/assets/660-init-deb.sh
# Move the script to the init.d directory & make executable
sudo mv init-deb.sh /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
# Add nginx to the system startup
sudo service nginx stop
class Name
def initialize(first_name, last_name)
@first_name = first_name
@last_name = last_name
end
def first_name
puts @first_name
end
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@ScottRadcliff
ScottRadcliff / powenv
Created March 28, 2014 20:46
Using RVM with Pow
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ]; then
source "$rvm_path/scripts/rvm"
source ".rvmrc"
fi
@ScottRadcliff
ScottRadcliff / merge-branch
Created February 28, 2014 12:49
Merge a branch and then delete it
#!/bin/bash
git merge $1 && git branch -d $1
$(document).ready(function(){
// Apparently I am not smart enough to figure out how to
// set the selected value on the new date_select form helper in Rails 4
// So, I had to create a client side solution
var url = document.location.href.split("?")[1];
// If the url does not have a query string
// Nothing else matters
if(url) {
var params = url.split("&");