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
| 'use strict'; | |
| var tcp = require('net'); | |
| var s1 = tcp.createServer().listen(9000); | |
| var s2 = tcp.createServer().listen(9001); | |
| var s3 = tcp.createServer().listen(9002); |
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
| module VarAccessor | |
| Sass::Script::Functions.send :include, self | |
| def self.variables | |
| @variables ||= {} | |
| end | |
| def self.set(values = {}) | |
| variables.merge! values | |
| 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
| # app/concerns/let.rb | |
| # Ripped from Rspec 2.0 beta.12 | |
| # I've found it so useful in Rspec, I made it into a module. Controller code with shared | |
| # code seem to have a lot of use for this. For example, in inherited_resources, you would | |
| # typically override model, parent, etc. to configure it. You would typically memomize it | |
| # as well. With this, you can use a more compact let() syntax. | |
| # (Note: This code will only work in Rails 3) | |
| module Let |
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
| BackButton = Ext.extend(Ext.Button, { | |
| ui: 'back', | |
| text: 'Back', | |
| hidden: true, | |
| id: 'back', | |
| handler: function() { | |
| var dispatchOptions = this.backStack.pop(); | |
| Ext.dispatch(dispatchOptions); | |
| if(this.backStack.length == 0) { |
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
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 cedmax <http://github.com/cedmax> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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 Listing < ActiveRecord::Base | |
| set_table_name :Listing | |
| scope :near, lambda{ | |
| |*args| | |
| origin = *args.first[:origin] | |
| if (origin).is_a?(Array) | |
| origin_lat, origin_lng = origin | |
| else | |
| origin_lat, origin_lng = origin.latitude, origin.longitude |
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
| # coderwall.coffee | |
| # Display coderwall.com badges | |
| username = "hermanjunge" | |
| el = $(".coderwall") | |
| $.getJSON "http://www.coderwall.com/#{username}.json?callback=?", (data) -> | |
| el.empty() | |
| for item in data.data.badges | |
| $("<img>") | |
| .attr( |
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
| git config --global color.diff auto | |
| git config --global color.status auto | |
| git config --global color.branch auto |
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
| // GET /COUNTRY/[COUNTRY_NAME] | |
| { | |
| "opennet_filtering_data": { | |
| "political": {"score": INT}, | |
| "social": {"score": INT}, | |
| "tools": {"score": INT}, | |
| "conflict_security" : {"score": INT} | |
| }, | |
| "google_removal_requests": { |
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 TicketsController < ApplicationController | |
| def show | |
| tickets = params[:tickets].split(",") | |
| ticket_data = tickets.map do |ticket| | |
| parallel { Faraday.get("http://tickets.local/#{ticket}") } | |
| end | |
| render json: { tickets: ticket_data.map(&:result) } | |
| end |
OlderNewer