Skip to content

Instantly share code, notes, and snippets.

@alecperkins
alecperkins / gist:7810285
Created December 5, 2013 18:06
This would be a cool feature of CoffeeScript
someFn
"#{ key }": val
foo: val2
@alecperkins
alecperkins / SassMeister-input-HTML.html
Created November 24, 2013 19:00
Generated by SassMeister.com.
<div class="IssueContents">
<div class="Theme">
<h2 class="ThemeTitle">Theme Title</h2>
<p class="ThemeContent">Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vestibulum id ligula porta felis euismod semper.</p>
</div>
<div class="Story -featured">
<h2 class="StoryTitle">Title</h2>
<p class="StoryPreview">Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vestibulum id ligula porta felis euismod semper.</p>
</div>
<div class="Story">
@alecperkins
alecperkins / SassMeister-input.sass
Created November 20, 2013 14:47
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
=item($extend: item)
@if $extend
@extend %#{ $extend }
@else
color: red
@alecperkins
alecperkins / SassMeister-input-HTML.html
Created November 12, 2013 13:09
Generated by SassMeister.com.
<div class="IssueContents">
<div class="Theme">
<h2 class="ThemeTitle">Theme Title</h2>
<p class="ThemeContent">Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vestibulum id ligula porta felis euismod semper.</p>
</div>
<div class="Story -featured">
<h2 class="StoryTitle">Title</h2>
<p class="StoryPreview">Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vestibulum id ligula porta felis euismod semper.</p>
</div>
<div class="Story">
@alecperkins
alecperkins / gist:7307518
Created November 4, 2013 19:00
Doodad extensibility
# Extend the Components as a way to provide defaults or add extra capability.
class TitleField extends StringField
placeholder : 'Title'
label : 'Title'
char_limit : 70
getValue: ->
value = super()
# do something with the value
return value
@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