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
# Be sure to restart your server when you modify this file | |
# Specifies gem version of Rails to use when vendor/rails is not present | |
RAILS_GEM_VERSION = '2.3.10' unless defined? RAILS_GEM_VERSION | |
# Bootstrap the Rails environment, frameworks, and default configuration | |
require File.join(File.dirname(__FILE__), 'boot') | |
Rails::Initializer.run do |config| | |
# Settings in config/environments/* take precedence over those specified here. |
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
begin | |
require "rubygems" | |
require "bundler" | |
rescue LoadError | |
raise "Could not load the bundler gem. Install it with `gem install bundler`." | |
end | |
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24") | |
raise RuntimeError, "Your bundler version is too old for Rails 2.3." + | |
"Run `gem install bundler` to upgrade." |
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 Rails::Boot | |
def run | |
load_initializer | |
Rails::Initializer.class_eval do | |
def load_gems | |
@bundler_loaded ||= Bundler.require :default, Rails.env | |
end | |
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
(ns udptest.core | |
(:import [java.net DatagramSocket | |
DatagramPacket | |
InetAddress] | |
[java.io BufferedReader | |
InputStreamReader])) | |
(set! *warn-on-reflection* true) | |
(defn- client [] |
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
@0x41e class Foo | |
att_accessor :foo | |
def initialize() | |
@foo = [] | |
end | |
end | |
x = Foo.new |
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
(defn minha-funcao [a b] | |
(println "a =" a "- b=" b)) | |
(-> "valor" | |
(minha-funcao "outro")) | |
; a = valor - b= outro | |
(->> "valor" | |
(minha-funcao "outro")) | |
; a = outro - b= valor |
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
#include <iostream> | |
#include <Windows.h> | |
#include <string> | |
namespace windows_threads | |
{ | |
class THREAD_PARAM | |
{ | |
public: | |
std::string name; |
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
;; Demonstrando a criação de interfaces Java e seu uso no Clojure | |
(definterface Poligono | |
(^String nome []) | |
(arestas []) | |
(^long vertices []) | |
(^double perimetro []) | |
(^double area [])) | |
(defn criar-quadrado [^double lado] |
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
;; comentários iniciados com dois ; são explicações minhas | |
; comentários iniciados com um ; é mensagem impressa pelo código | |
;; um atom é uma estrutura de dados quer permite modificações atômicas | |
;; de valor de forma segura e síncrona em um ambiente multithread. | |
;; aqui definimos um atom com valor inicial 0 | |
(def c (atom 0)) | |
(defn incx |
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
// Expectation: [1, 8, 6, 4, 3, 5, 7, 2] | |
var teams = [1, 2, 3, 4, 5, 6, 7, 8]; | |
var matches = []; | |
for(var pos = 0; pos < teams.length / 2; pos++) | |
{ | |
var even = pos % 2 === 0; | |
var ta = teams[pos]; | |
var tb = teams[(teams.length - 1) - pos]; |