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
load("@aspect_bazel_lib//lib:copy_file.bzl", "COPY_FILE_TOOLCHAINS", "copy_file_action") | |
def _adhoc_git_repository_impl(ctx): | |
copied_files = [] | |
for s in ctx.files.srcs: | |
if not s.is_source: | |
continue # fix if needed | |
f = ctx.actions.declare_file(ctx.label.name + "/" + s.path) |
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
const puppeteer = require('puppeteer'); | |
process.on('unhandledRejection', (reason, p) => { | |
console.error('Unhandled Rejection at: Promise ', p, ' reason: ', reason); | |
process.exit(3); | |
}); | |
(async () => { | |
let browser; | |
let exitCode = 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
class BaseScraper | |
def login | |
# логинится на сайте. сессия должна быть сохранена (в ООП подходе она хранится внутри объекта) | |
end | |
def get_data1(arg) | |
# выдирает данные одного вида, используя сохраненную сессию и обновляя её | |
end | |
def get_data2(arg1, arg2) |
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
async function zero(): Promise<number> { | |
console.log('zero'); | |
return 0; | |
} | |
async function add(origP: Promise<number>, inc: number): Promise<number> { | |
return inc + await origP; | |
} |
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
(set-env! | |
:source-paths #{"src/cljs" "src/clj"} | |
:resource-paths #{"html" "sql"} | |
:dependencies '[[org.clojure/clojure "1.8.0"] | |
[mount "0.1.9"] | |
[funcool/suricatta "0.8.1"] | |
[environ "1.0.2"] | |
[boot-environ "1.0.2" :scope "test"] |
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
def fill(a) | |
100_000.times { | |
a << rand(10000).to_s * 100 | |
} | |
end | |
def aa | |
ary = [] | |
fill(ary) |
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
namespace :cache do | |
desc "Clears Rails cache" | |
task :clear => :environment do | |
Rails.cache.clear | |
end | |
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
2.2.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
def bright?(color) | |
if color =~ /^#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})$/ | |
r = $1.to_i(16) | |
g = $2.to_i(16) | |
b = $3.to_i(16) | |
# Use formula to calculate brightness | |
# http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx | |
brightness = Math.sqrt(r*r*0.241+g*g*0.691+b*b*0.068) / 255 * 100.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
/** | |
* Copyright (c) 2013, Simone Pellegrini All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* | |
* - Redistributions of source code must retain the above copyright notice, | |
* this list of conditions and the following disclaimer. | |
* | |
* - Redistributions in binary form must reproduce the above copyright notice, |
NewerOlder