Skip to content

Instantly share code, notes, and snippets.

@alecperkins
alecperkins / config.rb
Created October 17, 2013 04:11
Messing around with Compass and npm. Because why the fuck not? Clone, `npm install`, `compass compile`.
additional_import_paths = ["./node_modules"]
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "./"
sass_dir = "./"
javascripts_dir = ""
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
@alecperkins
alecperkins / SassMeister-input-HTML.html
Created October 15, 2013 03:43
Making the first child full width if odd number of children. (And trying new naming scheme.)
<div class="Issue">
<div class="Issue_Cover" style="background-image: url(http://placepuppy.it/800/600/)"></div>
<h1 class="Issue_Title">Issue #1</h1>
<div class="Issue_Contents">
<div class="Story -featured"></div>
<div class="Story"></div>
<div class="Story"></div>
<div class="Story"></div>
<div class="Story"></div>
<div class="Story"></div>
@alecperkins
alecperkins / gist:6748189
Created September 29, 2013 00:51
Convert a bearing in degrees to a cardinal or ordinal direction. eg: 90 becomes E, 195 becomes SSW
bearingToDirection = (bearing, abbrev=true) ->
if abbrev
directions = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N']
else
directions = ['North', 'North-Northeast', 'Northeast', 'East-Northeast', 'East', 'East-Southeast', 'Southeast', 'South-Southeast', 'South', 'South-Southwest', 'Southwest', 'West-Southwest', 'West', 'West-Northwest', 'Northwest', 'North-Northwest', 'North']
return directions[Math.floor((bearing + 11.25) / 22.5)]
@alecperkins
alecperkins / index.md
Last active December 22, 2015 17:18
Comparing Congressional support for military action in Syria against received campaign contributions from Raytheon. http://view.activemarkdown.org/6504933

Congressional support for Syria versus Raytheon campaign contributions

Using campaign finance data organized by Open Secrets, and Syria support tallies from The New York Times.

Total contributions: []{total_contributions}$
Mean no-action: []{mean_noaction}$
Mean action: []{mean_action}$
Mean undecided: []{mean_undecided}$

@alecperkins
alecperkins / index.md
Last active December 22, 2015 17:09
Active Markdown example

St Ives

An old riddle.

As [I]{travelers: we or I} [was]{verb} going to St Ives
I met a man with [7 wives]{wives: 1..10}
Every wife had [7 sacks]{sacks: 1..10}
Every sack had [7 cats]{cats: 1..10}
Every cat had [7 kits]{kits: 1..10}
Kits, cats, sacks, wives

@alecperkins
alecperkins / actual_main.css
Last active December 18, 2015 05:29
Ideal Sass structure. Given `structure.md`, I wish the output would look like `ideal_main.css`. However, since `Block` gets imported twice and is a placeholder, not just something to extend, the rewritten selectors end up repeated. Getting around this requires `Feature/index.sass` to import `Block` instead of the ones that require it. Unfortunat…
.Image, .Text {
border: 1px solid red;
}
.Image {
border-color: green;
}
.Image, .Text {
border: 1px solid red;
}
.Text {
@alecperkins
alecperkins / opml_to_markdown.py
Created May 29, 2013 15:29
Convert an OPML outline to Markdown
"""
$ pip install opml
$ python opml_to_markdown.py some_outline.opml
-> some_outline.md
"""
import codecs
import opml
import sys
@alecperkins
alecperkins / gist:5414611
Last active December 16, 2015 09:39
Custom theme styles for Fargo (http://fargo.io). Adds some usability tweaks like hover states and a border indicating dropping a child vs a sibling. (Some of the rules are webkit specific since I primary use Chrome.) Feel free to use them, or fork and make them your own.
/* Hand cursor indicating the "wedge" is clickable. */
.node-icon {
cursor: pointer !important;
}
/* Keep the line-length of individual nodes from getting too wide. */
.concord-text {
max-width: 48em;
}
@alecperkins
alecperkins / active-markdown.md
Last active December 15, 2015 01:49
Active Markdown notation

String

A read-only output of the current value of the specified variable <var_name>. The text is the default value, though it will be replaced when the HTML version loads.

[<text>]{<var_name>}
#drop-target