Skip to content

Instantly share code, notes, and snippets.

View kana-sama's full-sized avatar
🌚

kana kana-sama

🌚
View GitHub Profile
# Я только-только начал изучать Ruby, мне очень понравилось то, что
# в языке очень много сахара. Но при этом там нет сахара для быстрых
# конструкторов, которые есть даже в C++ и CS
# constructor: (@name, @age) ->
class PersonOld
def initialize(name, age)
# вот эти строки меня и бесят
@name = name
@age = age
class Intersection {
constructor(id) {
this.id = id
this.roads = []
this.timeBeforeArrival = Infinity
}
addRoad({ destination, drivingTime }) {
this.roads.push({ destination, drivingTime })
}
function getSize(field) {
return Math.sqrt(field.length)
}
function new2D(size, filler = () => 0) {
return new Array(size).fill()
.map((_, i) => new Array(size).fill()
.map((_, j) => filler(i, j)))
}
package handlers
// import (
// "io"
// "net/http"
// "os"
// "path/filepath"
// "github.com/satori/go.uuid"
@kana-sama
kana-sama / config.json
Created June 22, 2016 10:38 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
func longFunc(x float64) float64 {
var sum float64 = 0
for i := float64(0); i < x; i++ {
sum = math.Sin(i)
}
return sum
}
#include <iostream>
#include <chrono>
#include <cmath>
int main() {
double sum;
auto start = std::chrono::system_clock::now();
for (double i = 0; i < 1000000; i++) {
#!/usr/bin/env bash
normalize_index() {
local index=$1
printf "%02d" $index
}
source_name() {
local index=$1
package prompter_test
import (
"fmt"
"reflect"
"testing"
"github.com/the-varlog/with/prompter"
)
@kana-sama
kana-sama / list.rb
Last active September 3, 2016 16:17
# для главной
[
{
name: "Манга",
color: "",
description: "",
icon: "",
products: [
{