This file contains 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 paypalAddressClient = (function() { | |
"use strict" ; | |
var SERVICE_URL = 'https://www.paypal.com/br/cgi-bin/webscr?cmd=_prefilladdress&countryCode={{#country}}&zipcode={{#zip_code}}' | |
var httpClient = new XMLHttpRequest(); | |
httpClient.onreadystatechange = function() { | |
if(this.status == 200 && this.readyState == httpClient.DONE) { | |
var response = this.responseText, | |
json_response = response.slice(response.indexOf("{")), | |
response_object = JSON.parse(json_response); |
This file contains 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 'mustache' | |
class MustacheTest | |
def self.init | |
template = DATA.read | |
puts Mustache.render(template, name: "User Name", email: 'user@email.com', subject: 'Contact', area: 'Marketing', question_type: '1', message: 'Hi there, i need some support (...)', date: Time.now.strftime("%d/%m/%Y %T"), ip: '127.0.0.1', origin: File.expand_path(__FILE__) ) | |
end | |
end | |
at_exit { MustacheTest.init } |
This file contains 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
SP_COORDINATES = [ | |
[-23.5362800,-46.6764790], # Perdizes | |
[-23.5386997,-46.6745478], | |
[-23.5409620,-46.6736037], | |
[-23.5436570,-46.6704065], | |
[-23.5464110,-46.6745264], | |
[-23.5471302,-46.6717029], # Av. Sumaré | |
[-23.5444353,-46.6765952], | |
[-23.5506316,-46.6774321], | |
[-23.5549590,-46.6676259], |
This file contains 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 runOptimized = function() { | |
"use strict"; | |
function getPrimes(){ | |
var primeCount, primes, obj; | |
primeCount = 0; | |
primes = new Array(100000); | |
obj = {}; | |
obj.getPrimeCount = function() { return primeCount; }; | |
obj.getPrime = function(i) { return primes[i]; }; | |
obj.addPrime = function(p) { primes[primeCount]=p; primeCount+=1; }; |
This file contains 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
--- | |
- :cod_uf: '52' | |
:uf: Goiás | |
:city_id: '00050' | |
:city: Abadia de Goiás | |
:sigla_uf: GO | |
:city_code: '5200050' | |
- :cod_uf: '31' | |
:uf: Minas Gerais | |
:city_id: '00104' |
This file contains 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
default: &default | |
adapter: postgresql | |
encoding: unicode | |
pool: 5 | |
username: root | |
password: | |
host: localhost | |
development: | |
<<: *default |
This file contains 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 MyCusthomMethods | |
def after(action_name, &block) | |
puts "(before) after action #{action_name}" | |
instance_eval(&block) | |
puts "(after) after action #{action_name}" | |
end | |
def deploy! |
This file contains 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
# course.rb | |
# rails g model course title:string | |
class Course < ActiveRecord::Base | |
has_and_belongs_to_many :disciplines | |
scope :programming, -> { | |
where("title LIKE ?", '%Programming%') | |
} | |
end |
This file contains 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
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
This file contains 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
// Ruby | |
[72, 97, 112, 112, 121, 32, 80, 114, 111, 103, 114, 97, 109, 109, 101, 114, 39, 115, 32, 68, 97, 121, 33].map(&:chr).join | |
// php | |
join(array_map("chr" , array(72, 97, 112, 112, 121, 32, 80, 114, 111, 103, 114, 97, 109, 109, 101, 114, 39, 115, 32, 68, 97, 121, 33))); | |
// JS | |
String.fromCharCode(72, 97, 112, 112, 121, 32, 80, 114, 111, 103, 114, 97, 109, 109, 101, 114, 39, 115, 32, 68, 97, 121, 33); | |
// C++ |
OlderNewer