This file contains hidden or 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
{ | |
"_id": "4172840", | |
"_index": "contacts_v1", | |
"_routing": "60635", | |
"_source": { | |
"account_id": 60635, | |
"actionable_per_type": [], | |
"billing_address": null, | |
"billing_address_city_suggest": {}, | |
"billing_address_country_suggest": {}, |
This file contains hidden or 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 __future__ import ... |
This file contains hidden or 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
#!/usr/bin/env python | |
import json | |
import sys | |
def list_duplicates(seq): | |
seen = set() | |
seen_add = seen.add | |
# adds all elements it doesn't know yet to seen and all other to seen_twice |
This file contains hidden or 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
-- here's the function used to actually drag & reorder tags | |
local function tag_drag(t) | |
local dr = mywibox[1]._drawable | |
mousegrabber.run(function (_mouse) | |
for k, v in ipairs(_mouse.buttons) do | |
if v then | |
local x = _mouse.x | |
local y = _mouse.y |
This file contains hidden or 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
#include <memory> | |
#include <iostream> | |
#include <type_traits> | |
#include <tuple> | |
#include <vector> | |
/* | |
* seq<> and gen<> are used to call function with arguments saved as a tuple | |
*/ | |
template<int...> |
This file contains hidden or 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
#include "foo.pb.h" | |
#include <iostream> | |
/* protocol: | |
message Foo | |
{ | |
message Pair | |
{ | |
required string key = 1; | |
required string value = 2; |
This file contains hidden or 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
#include <iostream> | |
#include <vector> | |
#include <functional> | |
enum message_type {PING, PONG}; | |
struct Message { | |
message_type m_type; | |
Message(message_type t) : m_type(t) {} | |
message_type type() const { return m_type; } |
This file contains hidden or 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
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <iostream> | |
#include <string.h> | |
int main() | |
{ | |
// -------------------------------------------- | |
struct sockaddr_in addr; |
This file contains hidden or 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
-- Construct 1 | |
-- =========== | |
-- ev1 >- time -< [ ev2 | |
-- , Null | |
-- ] | |
-- Means that if ev1 happens then ev2 may happen within time and then [ev2, ev1] | |
-- is reported. If ev2 does not happen within time, don't wait longer and report | |
-- [ev1, Null] == [ev1]. | |
-- | |
-- Note: ev1 will always be reported. |
This file contains hidden or 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 Main where | |
import Text.Printf | |
{- Module Fal is from the book "The Haskell School of Expression" by Paul Hudak. | |
- You need to read it, or google for the code -} | |
import Fal | |
count :: Event a -> Behavior Int | |
count ev = 0 `stepAccum` ev ->> (+1) |
NewerOlder