Opinions are like assholes, every one has got one.
This one is mine.
Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.
| # Activate in a modular Sinatra app: | |
| # | |
| # register Sinatra::Memcacher | |
| # set :memcacher_enabled, true | |
| # set :memcacher_expiry, 86400 | |
| # Cache an action: | |
| # | |
| # get '/' do | |
| # cache "index" do |
| <!doctype html> | |
| <!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ --> | |
| <html> | |
| <head> | |
| <title>iOS 8 web app</title> | |
| <!-- CONFIGURATION --> |
| curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary ' | |
| { "index" : { "_index" : "parent_child", "_type" : "store", "_id" : "store1" } } | |
| { "name" : "auchan", "owner" : "chris" } | |
| { "index" : { "_index" : "parent_child", "_type" : "department", "_id" : "department1", "parent" : "store1" } } | |
| { "name" : "toys", "numberOfProducts" : 150 } | |
| { "index" : { "_index" : "parent_child", "_type" : "product", "_id" : "product1", "parent" : "department1", "routing" : "store1" } } | |
| { "name" : "gun", "trademark" : "tiger", "price" : 9, "store_id" : "store1" } | |
| ' |
| #!/bin/bash | |
| # herein we backup our indexes! this script should run at like 6pm or something, after logstash | |
| # rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas, | |
| # compress the data files, create a restore script, and push it all up to S3. | |
| TODAY=`date +"%Y.%m.%d"` | |
| INDEXNAME="logstash-$TODAY" # this had better match the index name in ES | |
| INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/" | |
| BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put" | |
| BACKUPDIR="/mnt/es-backups/" | |
| YEARMONTH=`date +"%Y-%m"` |
| // an IIFE that illustrates different implementations | |
| // of $.post() with Promises | |
| // | |
| // Check out jsFiddle `jQuery and Promises with UI animation` | |
| // - demonstrates $.Deferrred() and custom $.when() | |
| // - @ http://jsfiddle.net/ThomasBurleson/RTLr6/179/ | |
| // | |
| var onSubmitFeedback = (function () { | |
| var target = $("#container").append("<div class='spinner'>"); |
| /* http://twitter.github.com/bootstrap/scaffolding.html#responsive */ | |
| /* Landscape phones and down */ | |
| @media (max-width: 480px) { ... } | |
| /* Landscape phone to portrait tablet */ | |
| @media (max-width: 768px) { ... } | |
| /* Portrait tablet to landscape and desktop */ | |
| @media (min-width: 768px) and (max-width: 940px) { ... } |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| source :rubygems | |
| gem 'sinatra' | |
| gem 'json' | |
| gem 'omniauth' | |
| gem 'omniauth-oauth2' | |
| gem 'omniauth-github' | |
| # gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__) | |
| gem 'thin' |
| # Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference. | |
| # The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2 | |
| # Step 0: Check what is going on at port 80 | |
| $ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c | |
| # Step 1: Increase the number of available fds | |
| $ ulimit -n 32000 | |
| # Step 2: Restart your webserver, for me: |