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 Lottery | |
attr_reader :lots_count, :balls_count | |
def initialize(lots_count, balls_count) | |
@lots_count = lots_count | |
@balls_count = balls_count | |
end | |
def full_basket |
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 AdsenseHelper | |
# Author: Tomasz Mazur ([email protected]) | |
# http://www.mydigitallife.info/2009/01/17/google-adsense-legacy-old-generation-code-reference-generate-and-get/ | |
# :slot | |
# :theme | |
# :background | |
# :border | |
# :link | |
# :text |
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
# TPD<<T220001293<<<<<<<<<<<<<<< | |
# 6408125<2010315D<<<<<<<<<<<<<4 | |
# MUSTERMAN<<ERIKA<<<<<<<<<<<<<< | |
class PersonalId | |
attr_reader :code, :data | |
# 9 alphanumeric | |
def initialize(machinecode = "TPD<<2406055684D<<<<<<<<<<<<<<6810203<0705109D<<<<<<<<<<<<<6MUSTERMAN<<ERIKA<<<<<<<<<<<<<<") | |
@code = machinecode |
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
window.flattenJSON = (obj) -> | |
flattened = {} | |
join = (path, key) -> | |
(if path is "" then "" else path + "_") + key | |
flattenArray = (arr, path) -> | |
flattenElement(arr, path, i) for i in [0...arr.length] | |
flattenObject = (obj, 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
FROM debian:buster | |
RUN apt-get update -qq && apt-get install -qqy \ | |
build-essential \ | |
python3-pip \ | |
python3-cffi \ | |
libpango-1.0-0 \ | |
libpangocairo-1.0-0 \ | |
libgdk-pixbuf2.0-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
FROM alpine:latest | |
RUN apk add \ | |
py3-pip \ | |
py3-pillow \ | |
py3-cffi \ | |
py3-brotli \ | |
gcc \ | |
musl-dev \ | |
python3-dev \ |
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
# please set up following github secrets in your repo: | |
# HEROKU_PIPELINE_NAME (https://devcenter.heroku.com/articles/pipelines#creating-pipelines) | |
# HEROKU_USER (your heroku username/email) | |
# HEROKU_API_KEY (use: 'heroku authorizations:create' for creating separate api_key for this purpose) | |
name: Heroku Review App Create | |
on: | |
pull_request: | |
types: opened |
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
// app.js | |
import React from 'react'; | |
class App extends React.Component { | |
componentDidMount() { | |
const retrieveImageFromClipboardAsBlob = (pasteEvent, callback) => { | |
if(pasteEvent.clipboardData === false){ | |
if(typeof(callback) === "function"){ |
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
-- SQL: https://clickhouse.com/docs/en/sql-reference | |
-- top db | |
SELECT endpoint, AVG(db) AS average_db, MIN(db) AS min_db, MAX(db) AS max_db, COUNT(*) AS count FROM ( | |
SELECT | |
CONCAT( | |
JSON_VALUE(json, '$.message.controller'), | |
'#', | |
JSON_VALUE(json, '$.message.action') | |
) AS endpoint, | |
simpleJSONExtractFloat(message, 'db') / 1000 as db |
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
# USAGE: retry 3 times on specified errors and wait 5s between retries | |
# when maximum retries is run then raise exception | |
# with_retries(on: [Errno::EHOSTUNREACH], tries: 3, interval: 5) do | |
# Net::HTTP.get('example.com', '/index.html') | |
# end | |
module WithRetries | |
def with_retries(on: [StandardError], tries: 3, interval: 0.5) | |
interval = 0 if Rails.env.test? # speed up tests |
OlderNewer