Skip to content

Instantly share code, notes, and snippets.

View zgulde's full-sized avatar

Zach Gulde zgulde

View GitHub Profile
<!doctype html>
<html>
<head>
<title>css boxes</title>
<link rel="stylesheet" type="text/css" href="/css/boxes.css">
</head>
<body>
<h1><a href="https://en.wikipedia.org/wiki/Visible_spectrum">Visible Spectrum Wavelengths</a></h1>
<div class="box red">620-750 nm</div>
@zgulde
zgulde / css boxes css
Last active September 26, 2015 01:38
h1{
color: purple;
text-decoration: underline;
}
.box{
height: 50px;
width: 150px;
color: white;
border: 1px solid black;
@zgulde
zgulde / mysql_logging.md
Last active December 8, 2015 16:45
How I enabled logging of all queries in mysql
  1. In your vagrant box edit /etc/mysql/my.cnf

  2. uncomment these two lines

    • #general_log_file = /var/log/mysql/mysql.log
    • #general_log = 1
  3. restart your vagrant box

  4. all queries will now be logged to /var/log/mysql/mysql.log

    • note that you will have to open a root shell to access this file
  5. (optionally) copy the log file somewhere

  • # cat /var/log/mysql/mysql.log &gt; /vagrant/sites/codeup.dev/logs/mysql.log
@zgulde
zgulde / sonicpi.rb
Created December 10, 2015 20:14
playing with sonic pi
arpeggios =
[
[:A3, :C4, :E4, :A4],
[:C4, :E4, :G4, :A4, :B4, :C5],
[:A3, :C4, :E4, :A4, :C5, :E5, :A5, :E5, :C5, :A4, :E4, :C4],
[:A5, :E5, :C5, :A4, :E5, :C5, :A4, :E4, :C5, :A4, :E4, :C4],
[:A3, :C4, :E4, :C4, :E4, :A4, :E4, :A4, :C5, :A4, :C5, :E5, :C5, :E5],
[:A4, :B4, :C5, :B4, :C5, :D5, :C5, :D5, :E5],
[:A5, :G5, :E5, :G5, :E5, :D5, :E5, :D5, :C5]
]
@zgulde
zgulde / sonicpi.md
Created December 10, 2015 20:29
explanation of my sonic pi code

Explanation

Explaining this code.

Everything used in the code is built into sonic pi, so (in theory) anyone could run it on their machine

I have a two dimensional array of arpeggios, arpeggios (this might not be the correct musical theory term for it), and an array of synths, synths

The loop will

@zgulde
zgulde / template.php
Created December 14, 2015 21:24
Proposed template for all of our html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Viewing All Ads</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/main.css">

How to use the model classes

modifying a record

$user = UserModel::find(2);
echo $user->first_name; // echos 'Henry'
// change the user's first name
$user->first_name = 'Mike';
$user-&gt;save();
@zgulde
zgulde / weather.js
Created December 30, 2015 04:36
my weather node cl tool
#!/usr/local/bin/node
function showHelp(){
console.log('+--------------------------------------------+');
console.log('| > weather [-v] [-f] |');
console.log('| -v - verbose |');
console.log('| -f - forecast, not the current weather |');
console.log('+--------------------------------------------+');
}
@zgulde
zgulde / myLib.js
Last active January 1, 2016 09:00
Number.prototype.times = function(cb){
for (var i = 0; i < this; i++) {
cb();
}
}
Number.prototype.to = function(n, step){
var array = [];
step = (typeof step != 'undefined') ? step : 1;
if (n > this){
@zgulde
zgulde / tellmeabout.js
Created January 11, 2016 14:54
node.js script for parsing php class source code
#!/usr/local/bin/node
var fs = require('fs');
var colors = require('colors');
var file = process.argv[2];
var contents = fs.readFileSync(file).toString();
// whitespace is nice