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
| ESTADOS_BRASIL = %w[AC AL AP AM BA CE DF ES GO MA MT MS MG PA PB PR PE PI RJ RN RS RO RR SC SP SE TO] |
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
| namespace Memoizer | |
| { | |
| /// <summary> | |
| /// Store a value so you don't run it twice | |
| /// </summary> | |
| public class Memoizer | |
| { | |
| private IDictionary<string, object> _frozenValues = new Dictionary<string, object>(); | |
| /// <summary> |
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
| source 'http://rubygems.org' | |
| gem "rake", "0.8.7" | |
| gem 'rails', '3.1.0' | |
| # Bundle edge Rails instead: | |
| # gem 'rails', :git => 'git://github.com/rails/rails.git' | |
| #gem 'mysql2', "~> 0.3.0" | |
| gem "pg" |
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
| -- T-SQL | |
| select | |
| (CONVERT([tinyint],(1)+rand(checksum(newid()))*(28),(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
| var foo = [0]; | |
| console.log(foo == !foo); | |
| console.log(foo == foo); |
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
| require "delegate" | |
| class A | |
| def self.class_meth | |
| "class method" | |
| end | |
| def self.class_meth_with_args a, b | |
| "class method args: " + a + b | |
| 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
| #pseudo code | |
| class User < ActiveRecord::Base | |
| named_scope :actives, where(:actived => true) | |
| end | |
| class BrunoUserClass < SomeDelegateClass(User) | |
| def self.actives | |
| super.where(name => "Bruno") | |
| 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
| public static class EnumerableExt { | |
| public static IEnumerable<U> Rank<T, TKey, U>( | |
| this IEnumerable<T> source, | |
| Func<T, TKey> keySelector, | |
| Func<T, int, U> selector) | |
| { | |
| if (!source.Any()) | |
| { | |
| yield break; | |
| } |
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
| using System; | |
| using System.Text; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| namespace Test | |
| { | |
| [TestClass] | |
| public class TestTransactionClass : TransactionalTest |
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
| public class Rectangle { | |
| private final int width; | |
| private final int height; | |
| public Rectangle(int width, int height) { | |
| this.width = width; | |
| this.height = height; | |
| } |