Skip to content

Instantly share code, notes, and snippets.

View noff's full-sized avatar

Michael Kechinov noff

  • REES46
View GitHub Profile
@noff
noff / Commands
Created July 21, 2020 18:25
Measure PHP vs Ruby
> time ruby rotate.rb
> time php rotate.php
[["Afghanistan", "AF"], ["Albania", "AL"], ["Algeria", "DZ"], ["American Samoa", "AS"], ["Andorra", "AD"], ["Angola", "AO"], ["Anguilla", "AI"], ["Antarctica", "AQ"], ["Antigua and Barbuda", "AG"], ["Argentina", "AR"], ["Armenia", "AM"], ["Aruba", "AW"], ["Australia", "AU"], ["Austria", "AT"], ["Azerbaijan", "AZ"], ["Bahamas", "BS"], ["Bahrain", "BH"], ["Bangladesh", "BD"], ["Barbados", "BB"], ["Belarus", "BY"], ["Belgium", "BE"], ["Belize", "BZ"], ["Benin", "BJ"], ["Bermuda", "BM"], ["Bhutan", "BT"], ["Bolivia (Plurinational State of)", "BO"], ["Bonaire, Sint Eustatius and Saba", "BQ"], ["Bosnia and Herzegovina", "BA"], ["Botswana", "BW"], ["Bouvet Island", "BV"], ["Brazil", "BR"], ["British Indian Ocean Territory", "IO"], ["Brunei Darussalam", "BN"], ["Bulgaria", "BG"], ["Burkina Faso", "BF"], ["Burundi", "BI"], ["Cabo Verde", "CV"], ["Cambodia", "KH"], ["Cameroon", "CM"], ["Canada", "CA"], ["Cayman Islands", "KY"], ["Central African Republic", "CF"], ["Chad", "TD"], ["Chile", "CL"], ["China", "CN"], ["Chri
https://api.rees46.com/banner?ssid=068924bd-4a1e-4c31-bdee-8550a0a78d62&shop_id=e8030027c16f7041c15db2da3bbd47&seance=wildberries&id=617
https://api.rees46.com/banner?ssid=068924bd-4a1e-4c31-bdee-8550a0a78d62&shop_id=e8030027c16f7041c15db2da3bbd47&seance=wildberries&id=618
https://api.rees46.com/banner?ssid=068924bd-4a1e-4c31-bdee-8550a0a78d62&shop_id=e8030027c16f7041c15db2da3bbd47&seance=wildberries&id=619
https://api.rees46.com/banner?ssid=068924bd-4a1e-4c31-bdee-8550a0a78d62&shop_id=e8030027c16f7041c15db2da3bbd47&seance=wildberries&id=620
https://api.rees46.com/banner?ssid=068924bd-4a1e-4c31-bdee-8550a0a78d62&shop_id=e8030027c16f7041c15db2da3bbd47&seance=wildberries&id=621
https://api.rees46.com/banner?ssid=068924bd-4a1e-4c31-bdee-8550a0a78d62&shop_id=e8030027c16f7041c15db2da3bbd47&seance=wildberries&id=622
https://api.rees46.com/banner?ssid=068924bd-4a1e-4c31-bdee-8550a0a78d62&shop_id=e8030027c16f7041c15db2da3bbd47&seance=wildberries&id=624
https://api.rees46.com/banner?ssid=068924bd-4a1e-4c31-bdee-8550a0
@noff
noff / poll-data.json
Last active July 3, 2017 21:50
Demo poll structure
{
"id": 2,
"title": "Feature phone Demo Module",
"description": null,
"questions": [
{
"id": 1,
"start": true,
"input": "radio",
@noff
noff / gist:8124475
Created December 25, 2013 15:59
parse utm's
var source = '';
var medium = '';
var campaign = '';
var q = document.location.search;
q = q.substring(1,q.length);
q = q.split('&');
for(var a in q) {
if (q.hasOwnProperty(a)){
var b = q.split('');
@noff
noff / log
Created December 6, 2013 12:10
Order Load (14.1ms) SELECT "orders".* FROM "orders" WHERE "orders"."shop_id" = $1 AND (date >= '2013-12-02 00:00:00.000000' and date <= '2013-12-02 23:59:59.999999') ORDER BY "orders"."date" ASC [["shop_id", 1]]
Item Load (1.4ms) SELECT "items".* FROM "items" INNER JOIN "order_items" ON "items"."id" = "order_items"."item_id" WHERE "order_items"."order_id" = $1 [["order_id", 1445]]
OrderItem Load (1.2ms) SELECT "order_items".* FROM "order_items" WHERE "order_items"."item_id" = $1 AND "order_items"."order_id" = 1445 LIMIT 1 [["item_id", 4548]]
Item Load (1.7ms) SELECT "items".* FROM "items" INNER JOIN "order_items" ON "items"."id" = "order_items"."item_id" WHERE "order_items"."order_id" = $1 [["order_id", 1446]]
OrderItem Load (1.1ms) SELECT "order_items".* FROM "order_items" WHERE "order_items"."item_id" = $1 AND "order_items"."order_id" = 1446 LIMIT 1 [["item_id", 5391]]
Item Load (1.1ms) SELECT "items".* FROM "items" INNER JOIN "order_items" ON "items"."id" = "order_items"."item_id" WHE
@Override
public SimpleItemItemModel get() {
// Get the transposed rating matrix
// This gives us a map of item IDs to those items' rating vectors
Map<Long, ImmutableSparseVector> itemVectors = getItemVectors();
// Get all items - you might find this useful
LongSortedSet items = LongUtils.packedSet(itemVectors.keySet());
// Map items to vectors of item similarities
@noff
noff / Code
Created September 14, 2013 08:15
Calls to graph_post_search_get have exceeded the rate of 10000 calls per 1 seconds. [HTTP 400]
app_id = "XXX";
app_secret = "YYY";
@oauth = Koala::Facebook::OAuth.new(app_id, app_secret)
app_oauth_token = @oauth.get_app_access_token
graph = Koala::Facebook::API.new(app_oauth_token)
while(true) do
@noff
noff / gist:6321451
Last active December 21, 2015 14:39
Daemon for track tweets by keywords
#!/usr/bin/env ruby
root = File.expand_path(File.dirname(__FILE__))
root = File.dirname(root) until File.exists?(File.join(root, 'config'))
Dir.chdir(root)
require File.join(root, "config", "environment")
require 'tweetstream'
@noff
noff / IRR
Created February 19, 2015 08:06
calculate = (valid = true) ->
# процент первого взноса от стоимости
calc_out.paid_pct = Math.round(100 * calc_in.paid / calc_in.total) + '%'
# подключаем библиотеку
calFinance = new Finance()
if calc_in.increase != null