Skip to content

Instantly share code, notes, and snippets.

#route
get 'tasks/todos-total', to: 'tasks#total_todos'
#tasks_controller
class TasksController < ApplicationController
before_action :set_task, only: [:show, :update, :destroy]
# GET /tasks
def index
@tasks = Task.all
{
"Parameters": {
"KeyPair":{
"Description": "Key pair for instance",
"Type": "AWS::EC2::KeyPair::KeyName"
}
},
"Resources": {
"S3Bucket": {
"Type" : "AWS::S3::Bucket",
@jhwhite
jhwhite / forecast.rb
Created November 20, 2015 18:47
Geocode and forecast
require 'forecast_io'
require 'geocoder'
require 'awesome_print'
require 'open-uri'
# Get public IP Address
remote_ip = open('http://whatismyip.akamai.com').read
#puts remote_ip
# Get geo data based on IP
import requests
from pprint import pprint

headers = {
    'ris-zip': '22911',
    'Accept-Encoding': 'gzip, deflate, sdch',
    'Accept-Language': 'en-US,en;q=0.8',
    'ris-chash': '30390833f3a0f4d1075f160ef72ca96f',
    'ris-appsig': 'b2145d17b741043a60a5ef2c360f2dee',

#Adding weather to your tmux status bar.

##Python file that writes the weather to a text file.

#!/Users/jhwhite/anaconda/bin/python
# -*- coding: utf-8 -*-

import forecastio
import math
library("ggplot2")
library("dplyr")
library("lubridate")
library("grid")
s3_files <- read.csv(file="s3.csv", head=FALSE)
colnames(s3_files) <- c("date", "time", "size", "filename")
s3_files$time <- hms(s3_files$time)
s3_files$hour <- factor(hour(s3_files$time))
@jhwhite
jhwhite / .vimrc
Last active August 29, 2015 14:13
1 set nocompatible " be iMproved, required
2 filetype off " required
3
4 set number
5 syntax enable
6 set backspace=indent,eol,start
7 colorscheme distinguished
8
9 " set the runtime path to include Vundle and initialize
10 set rtp+=~/.vim/bundle/Vundle.vim
@jhwhite
jhwhite / the-time-lord.zsh-theme
Last active August 29, 2015 14:09
My zsh prompt based on gallifrey.zsh-theme
# Based on gallifrey with a few small changes
function collapse_pwd {
echo $(pwd | sed -e "s,^$HOME,~,")
}
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%{$fg[green]%}$(collapse_pwd) $(git_prompt_info)%{$reset_color%}%B➜ %b '
RPS1="${return_code}"
@jhwhite
jhwhite / full-page-background-image.css
Last active December 24, 2015 02:09
CSS for perfect full page background images
.cover {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}