Skip to content

Instantly share code, notes, and snippets.

View Eunoia's full-sized avatar
🍍
bring the hustle

Evan R Eunoia

🍍
bring the hustle
View GitHub Profile
@Eunoia
Eunoia / details.md
Last active February 8, 2018 19:30
Pre planning

Howdy!

We're going to look at some data in Postgresql. To get started, you might want to get some useful tools first.

The good GUI client

https://macpostgresclient.com/

To install postgresql locally

brew install postgresql

@Eunoia
Eunoia / session_info.txt
Created July 5, 2017 16:16
results of running session_info
> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Year,Period,Area,Adjusted,Preliminary,Rate
"2016","Annual","Alameda County","Not Adj","Not Prelim","4.2"
"2015","Annual","Alameda County","Not Adj","Not Prelim","4.7"
"2014","Annual","Alameda County","Not Adj","Not Prelim","5.8"
"2013","Annual","Alameda County","Not Adj","Not Prelim","7.2"
"2012","Annual","Alameda County","Not Adj","Not Prelim","8.7"
"2011","Annual","Alameda County","Not Adj","Not Prelim","10.1"
"2011","Annual","Alameda County","Not Adj","Not Prelim","10.1"
"2010","Annual","Alameda County","Not Adj","Not Prelim","10.9"
"2010","Annual","Alameda County","Not Adj","Not Prelim","10.9"
@Eunoia
Eunoia / noodles.json
Created March 21, 2017 01:04
noodle map style
[
{
"elementType": "labels",
"stylers": [
{
"visibility": "off"
}
]
},
{
//! moment.js
//! version : 2.14.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.moment = factory()
//! moment.js
//! version : 2.14.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.moment = factory()
@Eunoia
Eunoia / sampler.js
Created February 16, 2016 17:00
Two ways to do the same thing.
// shorter
color = details.leftToPurchase < 0 ? 'red' : '#534F4E';
// more clear
if(details.leftToPurchase < 0){
color = 'red';
} else {
color = '#534F4E';
}
?>
<li class="one-third first single-item create-board" data-price="000000" data-category="!000000" data-source="000000" data-purchased="100000000000">
<a onClick='iframe_open("/popups/popup-add-item.php?name=<?php echo rawurlencode($project) . '&pnumber=' . $pnumber; ?>", "480", "200", "no")'>
<img src="images/plus-sign-large.png" alt="Add New Sum Board">
<p>Add New Item</p>
</a>
</li>
<?php
@Eunoia
Eunoia / high_outliers
Created November 20, 2015 01:13
Uses DescriptiveStatistics to find outliers
def self.high_outliers(column)
values = pluck(column)
q1 = DescriptiveStatistics::Stats.new(select{|d| d.send(column)<values.median }.map{ |d| d.send(column)}).median
q3 = DescriptiveStatistics::Stats.new(select{|d| d.send(column)>values.median }.map{ |d| d.send(column)}).median
iqr = q3-q1
select { |d| d.send(column)>(q3 + 1.5 * iqr) }
end
@Eunoia
Eunoia / tell_the_time.js
Created August 5, 2015 18:51
What if your clock was off? Get the time from other servers date headers
var http = require('http'),
fs = require('fs'),
loadDomains, getTheTimeFromServerList, formatDateHeader;
loadDomains = new Promise(function (resolve, reject) {
var servers;
fs.readFile('hostnames.txt', 'utf8', function (err, data) {
if (err) {
reject('Unable to read hostnames.txt');
}