2015-10-21
- jennifer
- martym
PWD = File.expand_path(File.dirname(__FILE__)) | |
VARIABLE_REGEX = %r{\<[A-Z\-]*\>} | |
class MTEngineError | |
class << self | |
def not_a_file(filepath) | |
raise "#{filepath} is not a file or does not exist" | |
end | |
end | |
end |
[user] | |
name = <username> | |
email = <email> | |
[credential] | |
helper = osxkeychain | |
[alias] | |
ci = commit | |
fu = fetch upstream | |
mum = merge upstream/master | |
pom = push origin master |
#! /bin/bash | |
if [[ $1 == 'me' ]]; then | |
cat "$(which show)" | |
elif [[ $1 == 'loc' ]]; then | |
echo `which show` | |
elif [[ $1 == 'install' ]]; then | |
echo "Ensure to place this file in `usr/local/bin` and read instructions on https://gist.github.com/swaathi/8c18be3a437e498034a5a3ede54d0ce9/." | |
brew install fortune | |
brew install cowsay | |
brew install lolcat |
from collections import defaultdict | |
class Graph: | |
def __init__(self, start, end): | |
self.nodes = set() | |
self.edges = defaultdict(list) | |
self.distances = {} | |
self.start = start | |
self.end = end | |
def add_node(self, value): |
require 'fileutils' | |
require 'securerandom' | |
directory = File.expand_path File.dirname(__FILE__) | |
textfiles = "#{directory}/textfiles" | |
FileUtils::mkdir_p textfiles | |
Dir["#{directory}/*.scss"].each do |file| | |
file_content = File.new(file, "r").read | |
rgbas = file_content.scan(/rgba\(([0-9, ]*)/) |
class Time | |
# Adds an offset to your time | |
# So you can go from | |
# Fri, 22 Jul 2016 07:56:38 UTC +00:00 | |
# To, | |
# Fri, 22 Jul 2016 13:26:38 UTC +00:00 | |
# | |
# Example, | |
# t = Time.now.utc | |
# => Fri, 22 Jul 2016 07:56:38 UTC +00:00 |
getNames: function(people) { | |
var length = people.length; | |
if (length == 0) { | |
return ""; | |
} else if (length == 1) { | |
return people[0].name; | |
} else if (length == 2) { | |
return people[0].name + " and " + people[1].name; | |
} else { |
var SongsSearch = React.createClass({ | |
render () { | |
return ( | |
<div> | |
<form ref="form" action={ this.props.searchPath } acceptCharset="UTF-8" method="get"> | |
<p><input ref="query" name="query" placeholder="Search here." onChange={ this.props.submitPath } /></p> | |
</form> | |
<a href="#" onClick={ this.props.cancelPath }>Cancel</a> | |
</div> |
var Song = React.createClass({ | |
render () { | |
return ( | |
<div> | |
<h4>{ this.props.artist } sang:</h4> | |
<p>{ this.props.name }</p> | |
</div> | |
) | |
} | |
}); |