Skip to content

Instantly share code, notes, and snippets.

Avatar

Aliaksandr Lomau allomov

View GitHub Profile
@allomov
allomov / custom-http-request-php-example.php
Last active Feb 17, 2020
Создание звонка через Custom HTTPS интеграцию с помощью PHP. YOUR_AUTHORIZATION_TOKEN и YOUR_INTEGRATION_URL берется из DealApp приложения https://www.notion.so/dealapp/Custom-HTTPS-v1-5288b1eebcc84188a383bd59755a0f40
View custom-http-request-php-example.php
<?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,
View searchkick_repro.rb
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 Jan 15, 2019
An example that demonstrates a simple app with Sinatra, html templates and jQuery.
View get-request.sh
curl -X GET http://localhost:4567
View monit.plist
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>
View matchjs.js
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 Jul 29, 2018
rubizza-camp rails introduction
View generate-students-fixture.rb
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
View gist:4389c642e40911140e960d89c37d1ff9
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 ]
View OperationManager.java
import java.math.*;
public class Operation {
double[] operatorsValues;
void setOperatorsValues(double[] values) { operatorsValues = values; }
String[] getOperationNames() {
return String[]{this.getFirstOperationName(), this.getSecondOperationName()}
}
View nodegit-checkout-tag.js
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()
View install-bosh-cli-and-concourse.yml
brew tap cloudfoundry/tap
brew install bosh-cli
brew link --overwrite bosh-cli
wget https://github.com/concourse/concourse/releases/download/v3.8.0/concourse-lite.yml
bosh create-env concourse-lite.yml