Skip to content

Instantly share code, notes, and snippets.

Avatar

Bret Davidson bretdavidson

  • North Carolina State University Libraries
View GitHub Profile
View gist:1a769920d3a90fac4c5d
# Before Vagrant.configure()
required_plugins = %w(vagrant-timezone)
required_plugins.each do |plugin|
need_restart = false
unless Vagrant.has_plugin? plugin
puts "Installing" + plugin + "..."
system "vagrant plugin install #{plugin}"
need_restart = true
end
View gist:02127543ea02d7106541
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="u.nest.js"></script>
<style>
.node circle {
fill: #fff;
stroke: steelblue;
@bretdavidson
bretdavidson / gist:3442123
Created Aug 23, 2012 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts
View gist:3442123

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@bretdavidson
bretdavidson / gist:3820069
Created Oct 2, 2012
Yahoo Leaked Passwords
View gist:3820069
# Statistics of the "450.000 leaked Yahoo accounts".
## More information available here:
http://blog.eset.se/statistics-about-yahoo-leak-of-450-000-plain-text-accounts/
https://twitter.com/nilssonanders
Total entries = 442773
Total unique entries = 342478
@bretdavidson
bretdavidson / README.md
Last active Dec 11, 2015 — forked from mbostock/README.md
Underscore.js equivalents in D3
View README.md

Collections

each(array)

Underscore example:

_.each([1, 2, 3], function(num) { alert(num); });
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Data Join Demo</title>
<style>
#control {
margin-bottom: 20px;
}
#chart {
width:500px;
@bretdavidson
bretdavidson / database.yml
Created Mar 13, 2013
Example for connecting RoR to a MAMP hosted database. Socket path assumes MAMP has been installed in the default directory. DATABASE_NAME, USERNAME, and PASSWORD will need to be replaced with the appropriate values from the database in MAMP. Default username and password are both root.
View database.yml
development:
adapter: mysql2
database: DATABASE_NAME
username: USERNAME
password: PASSWORD
socket: /Applications/MAMP/tmp/mysql/mysql.sock
host: localhost
pool: 5
timeout: 5000
encoding: utf8
View quotes.js
Handlebars.registerHelper('quotify', function (string) {
var string = string.replace(/[\u2018\u2019]/g, "'").replace(/[\u201C\u201D]/g, '"');
return string;
});