This file contains hidden or 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
| #!/bin/sh | |
| # Based on http://jswiki.lab-01.com/wiki/doku.php?id=install-couch | |
| echo "Downloading Linux build tools and Erlang" | |
| sudo apt-get install build-essential libicu-dev libcurl4-gnutls-dev libtool erlang-dev erlang zip -y | |
| # Work on tmp directory | |
| cd /tmp | |
| # Spidermonkey is required |
This file contains hidden or 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
| upstream some_app_server { | |
| server 127.0.0.1:9393; | |
| } | |
| server { | |
| listen 80; | |
| server_name my-upload-endpoint.com ; | |
This file contains hidden or 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
| # One liner for counting unique IP addresses from nginx logs | |
| # Feel free to comment with better ideas - I'm sure it's not the best way of doing this (I'm no awk ninja!) | |
| # | |
| # Sample output: | |
| # | |
| # $ cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }' | |
| # 66.65.145.220 49 | |
| # 92.63.28.68 126 | |
| cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }' |
This file contains hidden or 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 IamConnect.Collections.Locations extends Backbone.Collection | |
| url: '/api/locations' | |
| model: IamConnect.Models.Location | |
| _.extend IamConnect.Collections.Locations.prototype, IamConnect.Mixins.PaginationCollectionMethods.prototype |
This file contains hidden or 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 Product < ActiveRecord::Base | |
| has_many :products_materials | |
| has_many :materials, :through => :products_materials | |
| end | |
| class Material < ActiveRecord::Base | |
| has_many :products_materials | |
| has_many :products, :through => :products_materials | |
| end |
This file contains hidden or 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
| util = require "util" | |
| xmpp = require "node-xmpp" | |
| oscar = require 'oscar' | |
| express = require "express" | |
| ### | |
| The XMPP bot. | |
| ### |
This file contains hidden or 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
| # Let's assume you're driving Capybara in both RSpec request specs & Cucumber, | |
| # for example you're using Cucumber as a design/documentation tool, and RSpec | |
| # for the more boring integration tests. | |
| # You don't want to duplicate your click-this-click-that helpers to e.g. | |
| # log_in(username, password). | |
| # You may also have model state setup code which can be shared/reused. | |
| # Where can it go? How can it be loaded? I've been using the following approach: | |
| # |
This file contains hidden or 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
| # Simple and Stupid Ruby API for Coderwall.com | |
| # Vivien Didelot <vivien@didelot.org> | |
| require "open-uri" | |
| require "json" | |
| module CoderWall | |
| class Achievement | |
| attr_reader :name, :badge, :description |