Skip to content

Instantly share code, notes, and snippets.

View janetriley's full-sized avatar

Janet Riley janetriley

View GitHub Profile
@janetriley
janetriley / 0_reuse_code.js
Created June 9, 2016 17:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@janetriley
janetriley / general_resources.md
Last active September 9, 2015 13:55
Additional resources following Software Carpentry workshop.
@janetriley
janetriley / index.php
Last active August 29, 2015 14:08
A way to override Yii configuration settings with local settings.
<?php
//An excerpt from Yii's index.php file
$yii_path=dirname(__FILE__).'/yii/yii.php';
//The default set of config settings
$base_config = require(dirname(__FILE__).'/protected/config/main.php');
// Optionally redefine local settings in $local_config_path. These include:
# What if we had a row result from a database?
row = ['Mary','10', 'F']
output = 'Name: {name}, age: {age}, gender: {gender}'.format(name=row[0], age=row[1], gender=row[2])
print output
@janetriley
janetriley / gist:b14074e1475e7df5505b
Created May 15, 2014 03:52
RailsBridge - deploying app to heroku error
RailsBridge-VM:~/workspace/doublecheck$ more Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.5'
# Use sqlite3 as the database for Active Record
#
group :development do
@janetriley
janetriley / swedish_chef_decorator.py
Last active January 5, 2017 18:25
My first decorator! Translate text to Swedish Chef.
import re
"""
I wrote my first decorator following Colin Myer's PyCon2014 'Intro to Decorators' talk. Wheee!
"""
def chefalize(phrase):
"""convert HTML to Swedish Chef-speak
@janetriley
janetriley / .bashrc
Created January 17, 2014 03:24
Added this to RailsBridge vm .bashrc
## UNCOMMENTED THIS:
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
## CHANGED THE COLOR PROMPT TO SAY RailsBridge VM WITH COLORS
@janetriley
janetriley / .irbrc
Created January 17, 2014 03:17
Visual tweak to make IRB prompt visually different from plain command line. Make irb prompt red; add completion.
require 'irb/completion'
# Make prompt red: use ANSI color code \033[0;31m
IRB.conf[:PROMPT][:RAILSBRIDGE] = {
:PROMPT_I => "\033[0;31m%N:line %03n >",
:PROMPT_S => "%N:line %03n:%l \033[0;31m ",
:PROMPT_C => "%N:line %03n:* \033[0;31m ",
:RETURN => "%s\n"
}
@janetriley
janetriley / download_my_podcasts.py
Created December 3, 2013 01:47
A Python script to download podcasts from an xml feed and tag the MP3s.
"""
A script for downloading some podcasts and tagging the files so I can import them to iTunes.
"""
import pycurl
import os.path
import sys
from BeautifulSoup import BeautifulStoneSoup
import eyed3