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
<!DOCTYPE> | |
<html> | |
<head> | |
<meta charset='UTF-8'> | |
<title>D3</title> | |
<link rel='stylesheet' href='style.css'> | |
</head> | |
<body> | |
<svg width='960' height='500'></svg> |
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
letter | frequency | |
---|---|---|
A | .08167 | |
B | .01492 | |
C | .02782 | |
D | .04253 | |
E | .12702 | |
F | .02288 | |
G | .02015 | |
H | .06094 | |
I | .06966 |
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
$(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>{ | |
$(<span class="string">'#container'</span>).highcharts({ | |
xAxis: { | |
categories: [<span class="string">'Jan'</span>, <span class="string">'Feb'</span>, <span class="string">'Mar'</span>, <span class="string">'Apr'</span>, <span class="string">'May'</span>, <span class="string">'Jun'</span>, | |
<span class="string">'Jul'</span>, <span class="string">'Aug'</span>, <span class="string">'Sep'</span>, <span class="string">'Oct'</span>, <span class="string">'Nov'</span>, <span class="string">'Dec'</span>] | |
}, | |
series: [{ | |
name: <span class="string">'Tokyo'</span>, |
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 margin = {top: 20, right: 20, bottom: 30, left: 50}, | |
width = 960 - margin.left - margin.right, | |
height = 500 - margin.top - margin.bottom; | |
var formatDate = d3.time.format("%d-%b-%y"); | |
var x = d3.time.scale() | |
.range([0, width]); | |
var y = d3.scale.linear() |
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
class Employee | |
{ | |
void ProcessData() | |
{ | |
string name; | |
int code, salary; | |
// lots of other local variables... | |
// process name |
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
class Employee | |
{ | |
void ProcessData() | |
{ | |
var processor = new Processor(name, code, salary, ...); | |
processor.ProcessData(); | |
} | |
} | |
class Processor |
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 "json" | |
require "benchmark" | |
def measure(&block) | |
no_gc = (ARGV[0] == "--no-gc") | |
if no_gc | |
GC.disable | |
else | |
# collect memory allocated during library loading |
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
# api | |
web: bundle exec puma -C config/puma.rb | |
css: tailwindcss -i app/assets/stylesheets/application.css -o app/assets/stylesheets/wind.css --watch | |
js: yarn build --watch | |
# databases | |
redis: bundle exec redis-server | |
postgres: postgres -D /usr/local/var/postgres | |
# background jobs |
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 "money" | |
Money.locale_backend = nil | |
Money.rounding_mode = BigDecimal::ROUND_HALF_UP | |
module ProgrammingRuby | |
module Refactoring | |
class InvoicePrinter | |
def statement(invoice, plays) | |
total_amount = 0 |
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
#!/usr/bin/env ruby | |
require "net/ssh" | |
branch = `git rev-parse --abbrev-ref HEAD`.chomp | |
unless branch == 'main' | |
puts "oops! you're on a different branch. Merge your changes into main and then try again." | |
puts "exiting.." | |
return | |
end |