Skip to content
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Leaflet.draw drawing and editing tools</title>
<link
rel="stylesheet"
href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css"
/>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
<link
View index.html
<!doctype html>
<html>
<head>
<title>Leaflet.js - Mark Radius</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.5/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.5/leaflet.ie.css" /><![endif]-->
<link rel="stylesheet" href="styles.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.4.5/leaflet.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
View zoomstreet
<!DOCTYPE html>
<html>
<head>
<title>Custom search example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>html, body, #map { height: 100%; padding: 0; margin: 0 }</style>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Custom search example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>html, body, #map { height: 100%; padding: 0; margin: 0 }</style>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Gmaps example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
View ngAdmin Login
/*
Small ng-admin config showing how to inject a Login controller when
a 401 error is returned by the server.
*/
(function () {
"use strict";
var app = angular.module('myApp', [
View thousands.rb
# General case, English notation:
def pretty_number(num)
num.to_s.tap do |s|
:anything while s.gsub!(/^([^.]*)(\d)(?=(\d{3})+)/, "\\1\\2,")
end
end
# Puts the commas in the thousands, allows to use a character other than ',':
def pretty_number(number, comma = ',')
number.to_s.tap do |s|
View codility.rb
class Solution
attr_reader :array # => nil
def initialize(a)
@array = a # => [1, 5, 3, 4, 3, 4, 1, 2, 3, 4, 6, 2], [4, 5, 8, 5, 1, 4, 6, 8, 7, 2, 2, 5], [1, 5, 3, 4, 3, 4, 1, 2, 3, 4, 6, 2], [4, 5, 8, 5, 1, 4, 6, 8, 7, 2, 2, 5], [1, 5, 3, 4, 3, 4, 1, 2, 3, 4, 6, 2], [4, 5, 8, 5, 1, 4, 6, 8, 7, 2, 2, 5], [1, 5, 3, 4, 3, 4, 1, 2, 3, 4, 6, 2], [4, 5, 8, 5, 1, 4, 6, 8, 7, 2, 2, 5]
end
def peak?(left, center, right)
left < center && center > right # => true, false, true, false, true, false, false, false, false, true, false, true, false, false, false, false, true, false, false, false, false, true, false, true, false, true, false, true, false, false, false, false, true, false, true, false, false, false, false, true, false, false, false, true, false, true, false, true, false, false, false, false, true, false, true, false, false, false, false, true, false, false, false
end
View chessboard.rb
class Color
def initialize
@colors = ["R", "G", "B"] # => ["R", "G", "B"], ["R", "G", "B"]
end
def get
c = @colors.first # => "R", "G", "B", "R", "G", "B", "R", "G", "B", "R", "G", "B", "R", "G", "B", "R", "G", "B", "R", "G", "B", "R", "G", "B", "R"
@colors = @colors.rotate # => ["G", "B", "R"], ["B", "R", "G"], ["R", "G", "B"], ["G", "B", "R"], ["B", "R", "G"], ["R", "G", "B"], ["G", "B", "R"], ["B", "R", "G"], ["R", "G", "B"], ["G", "B", "R"], ["B", "R", "G"], ["R", "G", "B"], ["G", "B", "R"], ["B", "R", "G"], ["R", "G", "B"], ["G", "B", "R"], ["B", "R", "G"], ["R", "G", "B"], ["G", "B", "R"], ["B", "R", "G"], ["R", "G", "B"], ["G", "B", "R"], ["B", "R", "G"], ["R", "G", "B"], ["G", "B", "R"]
c # => "R", "G", "B", "R", "G", "B", "R", "G", "B", "R", "G", "B", "R", "G", "B", "R", "G", "B", "R", "G", "B", "R", "G", "B", "R"
end
View reverse.rb
input = "abc cba" # => "abc cba"
input = "cB!a This is a valid\n input, you have to read the specification carefully! abc" # => "cB!a This is a valid\n input, you have to read the specification carefully! abc"
input = input.downcase # => "cb!a this is a valid\n input, you have to read the specification carefully! abc"
input = input.gsub(/\W/) { |c| # => "cb!a this is a valid\n input, you have to read the specification carefully! abc"
c =~ /\s/ ? " " : "" # => "", " ", " ", " ", " ", " ", " ", "", " ", " ", " ", " ", " ", " ", " ", "", " "
} # => "cba this is a valid input you have to read the specification carefully abc"
arr = input.split(" ") # => ["cba", "this", "is", "a", "valid", "input", "you", "have", "to", "read", "the", "specification", "carefully", "abc"]
Something went wrong with that request. Please try again.