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
# A rought attempt at balancing text. Injects normal spaces (thus allowing a newline) after too many characters; otherwise | |
# adds a non-breaking space. | |
# | |
# It works in reverse because we'd rather have longer text on top than on bottom. | |
def some_non_breaking_spacing(s) | |
words = s.split(/\s+/).reverse | |
first_word = words.shift | |
html_tokens = [first_word] | |
chars_since_normal_space = first_word.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
.centerModal .modal-header{ | |
text-align:left; | |
} | |
.centerModal .modal-body{ | |
text-align:left; | |
} |
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
hideTimer = null | |
$('.launcher').popover(content: getContentHTML()) | |
.on('mouseenter', -> | |
$this = $(this) | |
$this | |
.on('shown.bs.popover', -> $('.popover') .addClass('the-popover')) | |
.popover('show') | |
clearTimeout hideTimer | |
$('.popover').on('mouseleave', -> $this.popover('hide')) | |
).on('mouseleave', -> |
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
def touch_icons | |
tags = [tag('link', rel: 'apple-touch-icon-precomposed', href: '/apple-touch-icon-precomposed.png')] | |
%w(36 48 57 72 76 114 120 144 152 180 192 512).each { |size| | |
tags += [tag('link', rel: 'apple-touch-icon-precomposed', size:"#{size}x#{size}", href: asset_path("logos/v3/icon#{size}x#{size}.png"))] | |
} | |
tags.join("\n").safe | |
end |
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
elementBottom = $(element).offset().top + $(element).height() | |
lowestVisiblePointInBrowser = $(window).scrollTop() + $(window).height() | |
isElementBottomVisible = lowestVisiblePointInBrowser > elementBottom |
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
# "provide" in controller for Rails streaming | |
# based on https://gist.github.com/hiroshi/985457 | |
# FORCE to implement content_for in controller | |
def view_context | |
super.tap do |view| | |
(@_provide || {}).each do |name,content| | |
view.provide name, content | |
end | |
end |
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
class Rainbow | |
def sass(command) | |
@@parser ||= Sass::Script::Parser | |
@@env = Sass::Environment.new | |
@@parser.parse(command, 0, 0).perform @@env | |
end | |
def saturation(color, amount) # amount is between -1 and 1 | |
sass "change-color(#{color}, $saturation: #{100*amount})" | |
end | |
def lightness(color, amount) # amount is between -1 and 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
> id3info NA-680-2014-12-21-Final.mp3 | |
│ | |
│*** Tag information for NA-680-2014-12-21-Final.mp3 | |
│=== TIT2 (Title/songname/content description): 680 NA-680-2014-12-21 | |
│=== TPE1 (Lead performer(s)/Soloist(s)): Adam Curry & John C Dvorak | |
│=== TALB (Album/Movie/Show title): No Agenda | |
│=== TCON (Content type): Podcast | |
│=== TENC (Encoded by): Fission | |
│=== COMM (Comments): ()[eng]: No Agenda Episode 680 - Sir Thomas Nussbaum presents "Sponsored Content" | |
│ Executive Producers: Sir RS Bagwell, Sir Oscar Nadal, Sir Barry Hanna, Todd McGreavy, Sir Ted Hosmann |
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
> ./go.rb | |
before join [] | |
Stored 2 | |
Stored 0 | |
Stored 1 | |
Stored 3 | |
Stored 4 | |
after join [2, 0, 1, 3, 4] |
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
on run {input, parameters} | |
tell application "Google Chrome" | |
activate | |
tell application "System Events" | |
tell process "Google Chrome" | |
set frontmost to true | |
set firstProfileSelected to (value of attribute "AXMenuItemMarkChar" of menu item 1 of menu "People" of menu bar 1) is "✓" |