Skip to content

Instantly share code, notes, and snippets.

View matthooks's full-sized avatar

Matt Hooks matthooks

View GitHub Profile
@matthooks
matthooks / readme.md
Last active November 12, 2020 16:41
Stripe Elements + Typekit

See comment below:

.user-profile {}
.user-profile__avatar {}
.user-profile__name {}
.user-profile__description {}
.user-profile__description__paragraph {}
.user-profile__website-link {}
// is faster than
.user-profile {}
App.EventIndexRoute = Ember.Route.extend
model: (params) ->
@modelFor("event")
handleSuccess: ->
console.log("Hooray")
handleFailure: (error) ->
if error.status is 422
model = @get("currentModel")
@matthooks
matthooks / asdf
Last active December 19, 2015 16:09
<script type="text/javascript">
window.SERVICES = <%= raw ActiveModel::ArraySerializer.new(@services).to_json %>
window.SERVICE_SUBCATEGORIES = <%= raw ActiveModel::ArraySerializer.new(@service_subcategories).to_json %>
</script>
@matthooks
matthooks / Thin (local)
Created April 6, 2012 22:55
Performance comparison for Facebook app between Thin and Unicorn
Server Software: thin
Server Hostname: localhost
Server Port: 5000
Document Path: /serve?username=nowspots
Document Length: 3070 bytes
Concurrency Level: 10
Time taken for tests: 146.587 seconds
Complete requests: 10000
{
"content": {
"field_groups": [
{
"keys": ["username"],
"repeat": false
}
]
},
"settings": {
firing pixel: http://p.nowspots-staging.com/event?ids=s%3A4ecab288b14b360001000067%2Ct%3A4de6f1b569db40775a000001%2Ca%3A4eb845059079f90001000002%2Cp%3A4ebd83d2d2f0160010000003&actions=profile-click&elapsed=381278&cb=1321908267111&url=http%3A//ads_app.dev/&stream=bszz
@matthooks
matthooks / gist:1379747
Created November 20, 2011 02:58
Simple counter cache setup for MongoMapper that supports single collection inheritance.
module CounterCache
extend ActiveSupport::Concern
module ClassMethods
def counter_cache(field)
class_eval <<-EOF
after_create "increment_counter_for_#{field}"
after_destroy "decrement_counter_for_#{field}"
EOF
end
html = """
This is a string in which you can insert #{stuff} and have many double quotes """""" without having to do \" to escape them
"""
html = """
<iframe id="#{id}_form" style="display:#{(!visible && 'none') || 'auto'}; width:400px; height:50px; border:0; overflow:hidden;" border="0" frameborder="0" scrolling="no" src="/attachments/new?target=#{id}&name=#{escape $attachment.val()}"></iframe>
"""