Skip to content

Instantly share code, notes, and snippets.

View allomov's full-sized avatar

Aliaksandr Lomau allomov

View GitHub Profile
require 'open-uri'
doc = Nokogiri::HTML(URI.open("https://www.oscars.org/oscars/ceremonies/2022"))
doc.css(".view-grouping-header h2")
@allomov
allomov / custom-http-request-php-example.php
Last active February 17, 2020 14:11
Создание звонка через Custom HTTPS интеграцию с помощью PHP. YOUR_AUTHORIZATION_TOKEN и YOUR_INTEGRATION_URL берется из DealApp приложения https://www.notion.so/dealapp/Custom-HTTPS-v1-5288b1eebcc84188a383bd59755a0f40
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "YOUR_INTEGRATION_URL",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "activerecord", require: "active_record"
gem "activejob", require: "active_job"
gem "sqlite3"
gem "searchkick", git: "https://github.com/ankane/searchkick.git"
end
@allomov
allomov / get-request.sh
Last active January 15, 2019 20:39
An example that demonstrates a simple app with Sinatra, html templates and jQuery.
curl -X GET http://localhost:4567
Xcloud@xcloud199 ~> cat /Library/LaunchDaemons/monit.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>monit</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/monit</string>
var url = 'http://localhost:8081/api/v2/deliverable_builds/6db57828-01b5-11e8-a40f-685b358e6aa5'
var idExtractor = /([\d\w\-]+)$/g;
var idMatch = idExtractor.exec(url);
console.log(idMatch[1]);
var typeExtractor = /\/([\w\d\_]+)\/[\d\w\-]+$/g;
var typeMatch = typeExtractor.exec(url);
console.log(typeMatch[1]);
@allomov
allomov / generate-students-fixture.rb
Last active July 29, 2018 19:53
rubizza-camp rails introduction
require "faker"
puts (1..13).map { |i| {name: Faker::RickAndMorty.character, bio: Faker::RickAndMorty.quote, number: rand(1000..9999), is_alive: [true, false].sample} }.reduce({}) {|res, obj| res[obj[:name]] = obj; res }.to_yaml
allomov:~/Downloads/onliner_analyzer → touch .ruby-version
allomov:~/Downloads/onliner_analyzer → touch .ruby-gemset
allomov:~/Downloads/onliner_analyzer → subl .
allomov:~/Downloads/onliner_analyzer → rvm list
rvm rubies
jruby-9.1.13.0 [ x86_64 ]
ruby-2.1.5 [ x86_64 ]
ruby-2.3.0 [ x86_64 ]
import java.math.*;
public class Operation {
double[] operatorsValues;
void setOperatorsValues(double[] values) { operatorsValues = values; }
String[] getOperationNames() {
return String[]{this.getFirstOperationName(), this.getSecondOperationName()}
}
var {Checkout, Submodule, Repository} = require("nodegit");
Repository.open("/native-repo")
.then(function(repository) {
return repository.getTagByName("v1.0.8")
.then(function(result) { console.dir(result); return result; })
.then(function(tag) { console.dir([tag.targetId(), repository.defaultSignature, "Checkout: HEAD " + tag.targetId()]); return tag; })
.then(function(tag) { repository.setHeadDetached(tag.targetId(), repository.defaultSignature, "Checkout: HEAD " + tag.targetId()) })
})
.then(function() { console.log("done");})
.done()