Skip to content

Instantly share code, notes, and snippets.

View VojtechBartos's full-sized avatar
🏠
Working from home

Vojta Bartoš VojtechBartos

🏠
Working from home
View GitHub Profile
@Richard-Mathie
Richard-Mathie / kafka_worker.py
Created October 31, 2018 16:28
Kafka Consumer for Long Running Process
from threading import Thread, Event
from queue import Queue, Empty
from kafka import KafkaConsumer, KafkaProducer
from kafka.structs import TopicPartition, OffsetAndMetadata
from kafka.consumer.fetcher import ConsumerRecord
from kafka.errors import CommitFailedError
class KafkaWorker(object):
def __init__(self, topics, hosts, poll_timeout=1):
var AppConstants = require('../constants/AppConstants.js');
var AppDispatcher = require('../dispatchers/AppDispatcher.js');
var api = require('../utils/api');
var ActionTypes = AppConstants.ActionTypes;
module.exports = {
create_customer: function(data){
api.customer.create(data);
}
@JakubTesarek
JakubTesarek / .bashrc
Last active October 27, 2021 19:59
.bashrc file with useful shortcuts. The file can update itself using `updaterc`. Also contains detection of platform it's running on
# if not running interactively, don't do anything
[ -z "$PS1" ] && return
# Detect platform
platform='unknown'
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
platform='linux'
elif [[ "$unamestr" == 'FreeBSD' ]]; then
platform='freebsd'
@tungd
tungd / react-helper.js
Last active November 30, 2018 06:33
React Helper to initialize the component from HTML, similar to AngularJS.
/**
* react-helper.js
*
* Helper for Facebook's React UI Library. Add support for declare
* component on DOM (similar to AngularJS Directive).
*
* Usage:
* - Register a component:
* ReactHelper.register('MyComponent', MyComponent)
* - Declare the DOM node:
@vojtajina
vojtajina / all-templates.html
Created August 15, 2012 00:00
AngularJS: load all templates in one file
<script type="text/ng-template" id="one.html">
<div>This is first template</div>
</script>
<script type="text/ng-template" id="two.html">
<div>This is second template</div>
</script>
anonymous
anonymous / mysql wrapper class
Created July 19, 2012 02:24
MySql Connection pool & Auto reconnection
/*
use ver 2
provide:
connection pool
auto reconnect
Usage:
MySql = require 'lib/mysql' This one
mysql = new MySql(Config)
@lost-theory
lost-theory / gist:3005268
Created June 27, 2012 16:35
consume JSON REST API blueprint inside flask app
from flask import Flask, jsonify, Blueprint, current_app
import json
## REST api ###################################################################
api = Blueprint('api', __name__)
@api.route("/users")
def users():
return jsonify(users=[
@ziadoz
ziadoz / awesome-php.md
Last active May 10, 2024 15:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
#!/bin/sh
~/Applications/UniversalIndentGUI/indenters/uncrustify -l OC -q -c ~/Applications/UniversalIndentGUI/config/uncrustify_obj_c.cfg