Skip to content

Instantly share code, notes, and snippets.

View JaheMerah's full-sized avatar

Mindaugas JaheMerah

View GitHub Profile
@zergov
zergov / djangoseats.md
Last active May 1, 2017 20:08
Django seats

Django seats proposal

introduction

This is a technical proposal exposing the core idea behind the Django seats lib. In this document, the notion of front-end and user interface is not discussed.

Scope of the library

The lib should be simple and easy to use. Its goal is the following: encapsulate the events of booking and releasing a seat on a floorplan. The lib should provide hooks on those events that developer can use to implement their business logic.

@defp
defp / redis_pool.lua
Created April 10, 2017 09:34
service/redis_pool.lua
local skynet = require "skynet"
local redis = require "redis"
local parse_redis_url = require "redis_url".parse
local sort = table.sort
local unpack = table.unpack
local conf
local pool = {}
local named = {}
--local rooms = cjson.decode(redis.call('GET', 'searchRoom'))
--local rates = cjson.decode(redis.call('GET', 'searchRates'))
--local currentRedisData = cjson.decode(redis.call('GET', 'currentRedisData'))
--local currentRoomsData = cjson.decode(redis.call('GET', 'currentRoomsData'))
--local searchParams = cjson.decode(redis.call('GET', 'searchParams'))
local searchParams = {days = {'20160701', '20160702', '20160703', '20160704', '20160705', '20160706', '20160708', '20160709'}}
local util = {}
local refFields = {
fields = {
quantity = 'a',
@samael500
samael500 / handler.lua
Last active August 25, 2023 15:11
Validating payloads from GitHub webhooks with Nginx + Lua
-- luarocks install JSON4Lua
-- luarocks install luacrypto
local json = require "json"
local crypto = require "crypto"
local secret = '<MY SUPER SECRET>'
local event = 'push'
local branch = 'refs/heads/master'
@noogen
noogen / pmcproxy.php
Last active April 19, 2017 20:55
pmcproxy.php
<?
/**
* Poor Man Cache Proxy
**/
function makeRequest($url, $method)
{
$opts = array(
'http' => array(
'method' => $method,
'header'=> "Accept: application/json\r\n"
@noogen
noogen / dailyproxy.php
Last active April 19, 2017 20:56
dailyproxy.php
<?
/**
* The task fo this script is to proxy request to a URL with a daily limit
**/
# limit one, change this if you want to change the limit
$DAILYLIMIT = 1;
$SECRET = "some-secret";
function makeRequest($url, $method)

Literature Review

"Sales Territory Design: Thirty Years of Modeling and Implementation" Zoltners and Sinha (2005)

Sales Territory Alignment:

  • "The assignment of accounts and associated selling activities to salespeople and teams"
  • Also known as sales territory design, assignment, deployment, realignment and districting

Salesforce Structures

  • Generalist structure: salesperson assigned to specific geographic area
@baddot
baddot / webhook.php
Created March 23, 2017 18:32 — forked from visitdigital/webhook.php
Very Simple Facebook Chat Bot PHP Webhook Script Example
<?php
$challenge = $_REQUEST['hub_challenge'];
$verify_token = $_REQUEST['hub_verify_token'];
// Set this Verify Token Value on your Facebook App
if ($verify_token === 'testtoken') {
echo $challenge;
}
$input = json_decode(file_get_contents('php://input'), true);