This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Hmisc) | |
library(survey) | |
# Import data from SAS transport file | |
data <- sasxport.get('data/h171.ssp') | |
# Build survey object using person weights | |
full_population_survey <- svydesign(ids=~1, data=data, weights=~perwt14f) | |
# Find cutoff for top 5 percent of spenders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const record = require('node-record-lpcm16'); | |
const {Detector, Models} = require('./node_modules/snowboy/'); | |
const Gpio = require('onoff').Gpio; | |
// Set up control of the pin that toggles the Powerswitch | |
power = new Gpio(14, 'out'); | |
var on = false; | |
// Turn the power off by default | |
power.writeSync(0); |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 52 columns, instead of 31. in line 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
area_fips,state,name,clinton_raw,sanders_raw,clinton_percent,sanders_percent,bush_raw,carson_raw,christie_raw,cruz_raw,fiorina_raw,huckabee_raw,kasich_raw,rubio_raw,santorum_raw,trump_raw,bush_percentage,carson_percentage,christie_percentage,cruz_percentage,fiorina_percentage,huckabee_percentage,kasich_percentage,rubio_percentage,santorum_percentage,trump_percentage,1975_raw_manufacturing,1975_percent_manufacturing,1975_raw_total,1993_raw_manufacturing,1993_percent_manufacturing,1993_raw_total,2007_raw_manufacturing,2007_percent_manufacturing,2007_raw_total,2014_raw_manufacturing,2014_percent_manufacturing,2014_raw_total,1975_to_1993_manufacturing,1975_to_1993_total,1993_to_2007_manufacturing,1993_to_2007_total,2007_to_2014_manufacturing,2007_to_2014_total,1975_to_2014_manufacturing,1975_to_2014_total,gini,gini_adjusted,college_or_higher,poverty_level,percent_white_alone | |
26001,Michigan,ALCONA,463,455,48.74,47.89,13,27,5,460,4,2,340,138,4,1111,0.61,1.26,0.23,21.47,0.19,0.09,15.87,6.44,0.19,51.84,94,17.06,551,2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "Hillary Clinton", | |
"party": "D", | |
"bound": 954, | |
"unbound": 122, | |
"states": [ | |
{ | |
"state": "PA", | |
"bound": 40, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
$scheduleArray = explode( "<p><strong>", $schedule ); | |
for( $j = 0; $j < count( $scheduleArray ); $j++ ) { | |
$scheduleArray[$j] = strip_tags( $scheduleArray[$j] ); | |
$scheduleArray[$j] = trim( str_replace( " ", "", $scheduleArray[$j] ) ); | |
//parse split press release into export array | |
$start = 0; | |
if( $scheduleArray[$j] != "" ) { | |
$tempArray = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
// For this example, $ngram = 1, meaning we're only looking at one word at a time and not phrases | |
$textArray = explode( " ", $formatted ); // $formatted is the text sample with most punctuation removed | |
for ( $i = 0; $i < count( $textArray ) - $ngram; $i++ ) { | |
$chunk = ""; | |
for ( $j = 0; $j < $ngram; $j++ ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// thenBy.js, sorting library | |
/*** Copyright 2013 Teun Duynstee Licensed under the Apache License, Version 2.0 ***/ | |
var firstBy=function(){function n(n,t){if("function"!=typeof n){var r=n;n=function(n){return n[r]}}if(1===n.length){var u=n;n=function(n,t){return u(n)<u(t)?-1:u(n)>u(t)?1:0}}return-1===t?function(t,r){return-n(t,r)}:n}function t(t,u){return t=n(t,u),t.thenBy=r,t}function r(r,u){var f=this;return r=n(r,u),t(function(n,t){return f(n,t)||r(n,t)})}return t}(); | |
var limit = 3; // Number of places to display | |
// Get data from endpoint | |
d3.json("http://traveltracker.nationaljournal.com/api/widget", function(err, data){ | |
// Sort by date and number of trips |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script> | |
<script src="swatches.json"></script> | |
<script type="text/javascript"> | |
angular.module("swatchApp", []) | |
.controller('swatchController', ['$scope', function($scope){ | |
$scope.colors = swatches; | |
$scope.height = window.innerHeight / swatches.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE contributions_individual ADD COLUMN contbr_nm_short varchar(200); | |
UPDATE contributions_individual set contbr_nm_short = SUBSTRING_INDEX(contributions_individual.contbr_nm, ' ', 2); | |
SELECT contributions_individual.cand_nm, | |
contributions_individual.contbr_nm_short, | |
contributions_individual.contbr_zip, | |
SUM(contributions_individual.contb_receipt_amt) as total, | |
b.cand_nm, | |
b.contbr_nm_short, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require("fs"); | |
var http = require('http'); | |
fs.readFile("data.json", 'utf8', function(err, data){ | |
data = JSON.parse(data); | |
data.Results.forEach(function(email, i){ | |
console.log("http://foia.state.gov/searchapp/"+email.pdfLink); | |
// use a timeout so State's server doesn't get mad |