Skip to content

Instantly share code, notes, and snippets.

Avatar

Austin Bales arbales

View GitHub Profile
@arbales
arbales / handlebars-formatTextForHTML.coffee
Created Jan 22, 2012
Replace URLs with links and unicode emoji with images.
View handlebars-formatTextForHTML.coffee
LINK_DETECTION_REGEX = /(([a-z]+:\/\/)?(([a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(\s+|$)/gi
EMOJI_DIRECTORY = "/path/to/assets/emoji/20x20"
# Handlebars is presumed, but you could swap out
ESCAPE_EXPRESSION_FUNCTION = Handlebars.Utils.escapeExpression
MARKSAFE_FUNCTION = (str) -> new Handlebars.SafeString(str)
# Emoji unicode chars become images.
View gist:592332
<html>
<head>
<title>Checkbox</title>
<style>
input[type=checkbox] {
display:none;
}
input[type=checkbox] + label
{
View Quip Feedback.md

First, I appreciate that the team isn't resting on its laurels and is willing to take risks and do redesigns, please keep going! More iteration!

  1. I prefer the menubar design found in the last version of Quip sheets
  2. The new conversation view is header to read without bubbles
  3. The Share CTA in the conversation view is too bright / distracting
  4. The (x) floating button to hide the conversation view isn't salient enough and the button to restore it is buried in the Application menu.
@arbales
arbales / gist:8203385
Created Dec 31, 2013
Illustrates downloading a file in MacRuby. — From a question on StackOverflow about the corruption of downloaded files in MacRuby.
View gist:8203385
def download_request(url, filePath:path, progressIndicator:progressBar)
file = File.open(path, "w+")
begin
Net::HTTP.get_response URI.parse(url) do |response|
if response['Location']!=nil
puts 'Direct to: ' + response['Location']
return download_request(response['Location'], filePath:path, progressIndicator:progressBar)
end
View react-example.js
render: function(){
var tm = window.ReactTemplates[this.templateName];
if (typeof tm === 'function') {
return tm.apply(this, arguments);
} else {
// however errors work in React
}
}
View comment_form.jsx
<form class="commentForm" onSubmit={this.handleSubmit}>
<input type="text" placeholder="Your name" ref="author" />
<input
type="text"
placeholder="Say something..."
ref="text"
/>
</form>
View gist:5660690
# Take a MM:SS.MS formatted string and return an integer of MS
def timestring_to_ms(string)
a=[1, 1000, 60000]*2
string.split(/[:\.]/).map{|time| time.to_i*a.pop}.inject(&:+)
end
@arbales
arbales / application.hbs
Created May 9, 2013
Actions specified inside the {{render}} helper appear not to reach their specified controller.
View application.hbs
{{#render "header"}}
<header class="header-main">
<!--
* Dropping the debugger here has this.controller properly
set (<Ab.HeaderController:emberXXX>).
* this.view is null, although render.js#L57 correctly finds the object named 'view:header'
* Calling this.controller.toggleMode() from the debugger works as expected.
-->
View gist:4727806

SAN FRANCISCO, Ca. — "Salesforce brings Santa's list to the cloud"

Salesforce.com (CRM) today announced a joint venture with the Coca Cola Corporation (KO), the owners of Santa's life spirit, called GiftForce.com.

Salesforce.com CEO and co-founder Marc Benioff spoke at a press event held in Rejkavik, "We're extremely excited to work with a true leader in building customer relationships – Santa Klaüs and the North Pole Division at Coke."

"DemandForce will change the way Santa runs his workshop," said Sqent Forest, Executive Director of Elf Operations at Coke's North Pole Division. "Until Salesforce.com, we've relied on legacy IT systems from as far back at 1800 to manage the world's largest distributed gift registry"

Forest noted that North Pole has thousands of gift service representatives, responsible for opening each letter received by the Coke subsidiary, and said that "Salesforce.com will literally change the game in social holiday Santa gift requests… we're ready to be reborn cloud."

View gist:4075217
@import "object/*.png"
@import "actions/*.png"
@include all-object-sprites
@include all-actions-sprites
/*
A mixin to create sprited icons that respond to
:hover, :active, and .active with a different image.
Meant to be paired with icons generated in the images-neue folder.