Skip to content

Instantly share code, notes, and snippets.

View joshuarrrr's full-sized avatar

Josh Romero joshuarrrr

View GitHub Profile
@joshuarrrr
joshuarrrr / instructions.md
Last active February 6, 2017 21:16
Clone a local version of a Wordpress site
  1. Install Duplicator plugin

  2. Build package (optionally filter out large image files)

  3. Download archive and installer to an empty directory

  4. Create a softlink to the directory ({name}) in the webserver folder

    $ sudo ln -s /{name} /var/www/html/{name}
    
  5. Change ownership of the directory to make it writable

@alykat
alykat / gist:5fabb42475a6111ccc38591bac09550a
Created April 1, 2016 21:18
D3: Wrap label text and make SVG taller
/*
* Wrap a block of text to a given width
* via http://bl.ocks.org/mbostock/7555321
*/
var wrapText = function(texts, width, lineHeight) {
texts.each(function() {
var text = d3.select(this);
var words = text.text().split(/\s+/).reverse();
var word = null;
@akanik
akanik / excel-csv.py
Last active May 15, 2018 15:26
excel sheets to individual csv files
# Thanks to http://stackoverflow.com/questions/9884353/xls-to-csv-convertor
import os, csv, xlrd
excel_file = '/path/to/file.xls'
#we're specifying a directory here because we'll have several files
#be sure to include end slash
csv_filepath = 'path/to/csv/directory/'
def csv_from_excel(excel_file):
workbook = xlrd.open_workbook(excel_file)
@stucka
stucka / gist:978d497d3d77fe12883a
Last active October 11, 2017 18:00
Prep new Xubuntu VM
apt-get install virtualbox-guest-dkms
# Enable bidirectional clipboard: Virtualbox Machine menu, Settings, General, Advanced, Shared Clipboard.
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
# Get Slack at https://slack.com/downloads/instructions/ubuntu
@iansltx
iansltx / rerender.js
Created February 3, 2015 08:23
Force element re-render on print
(function() { // force re-render of element_name to get the styling right on-print
var beforePrint = function() {
var el = document.getElementById('element_name'); // e.g. an input inside a <p>...
var p = el.parentNode; // ...which will normally fail to style entirely on-print...
p.removeChild(el); // ...but if you wrap it in a <span> or the like, then remove and re-add the element...
p.appendChild(el); // ...the styles will recalculate and you'll get whatever style you were trying to apply!
};
if (window.matchMedia) {
window.matchMedia('print').addListener(function(mql) {
@jenofdoom
jenofdoom / font-squirrel-mixin
Created January 7, 2015 03:12
SCSS mixin for font squirrel font import
// font families!
@mixin font-face($fontname, $filename: $fontname, $weight: normal, $style: normal) {
// based on font squirrel output, without SVG (too legacy)
@font-face {
font-family: $fontname;
src:url('../fonts/#{$filename}.eot');
src:url('../fonts/#{$filename}.eot?#iefix') format('embedded-opentype'),
url('../fonts/#{$filename}.woff2') format('woff2'),
url('../fonts/#{$filename}.woff') format('woff'),
url('../fonts/#{$filename}.ttf') format('truetype');
@osoken
osoken / data.csv
Last active May 10, 2017 16:55
Dot bar chart
year A B C D E F G
0 401 150 0 144 48 410 803
1 419 299 90 141 80 180 802
2 468 440 97 95 48 42 860
3 585 459 100 99 48 71 702
4 462 634 89 80 44 104 670
5 423 233 81 84 19 361 882
@julionc
julionc / 00.howto_install_phantomjs.md
Last active April 26, 2024 09:13
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@rengel-de
rengel-de / index.html
Last active January 30, 2024 20:47
Timeline for d3 - proof-of-concept
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="keywords" lang="de" content="Zeitleiste, Zeitlinie, Zeitkarte, Geschichte, Chronologie">
<meta name="keywords" lang="en" content="Timeline, Timemap, History, Chronology">
<title>Timeline - Proof-of-concept</title>
<!-- That's my local d3 path. When working locally, use your local path. -->
@eyeseast
eyeseast / beats.md
Last active December 14, 2015 03:59
Notes on beat reporting with data.
  1. Humans are bad at seeing trends. We focus on anecdotes and tend to overvalue outlyers. We look for odd cases instead of what's normal. Your eyes will deceive you; don't trust them. CAR reporters tend to be better at handling this, so I want to extract the tools used for investigative projects and apply them to daily reporting.

  2. It's hard to see the whole story. Problems like crime, climate change or economics don't benefit from incremental updates--indeed, they can add to confusion--until you know the big picture. This is where better tools can help, like a database that captures the information reporters collect in the course of writing stories.

  3. It's hard to know what matters. Don't commit to an information structure until you know what you're dealing with, and even then, be prepared to change. If your framework doesn't match reality, change your framework. This is in the weeds a bit, but it's important to deal with, since structures enforce a certain rigidity.

  4. **Information gets lo