Skip to content

Instantly share code, notes, and snippets.

Tomek Cejner tomekc

View GitHub Profile
@tomekc
tomekc / database.go
Created Jul 3, 2020
Trivial REST API returning contents of database
View database.go
package main
import (
"context"
"database/sql"
"encoding/json"
_ "github.com/go-sql-driver/mysql"
"net/http"
. "strings"
)
@tomekc
tomekc / nested-for-loops.js
Created Feb 16, 2020
Zagnieżdżone pętle for w JavaScripcie
View nested-for-loops.js
console.log(`Hi!`);
// Odpowiednik enuma w TypeScripcie
let ProjectType = {
CURRENT: "CURRENT",
CLOSED: "CLOSED"
}
let projectsOfUser1 = [
{ name: 'Proj1', type: ProjectType.CURRENT },
@tomekc
tomekc / scene-template.lua
Created Dec 10, 2019
Corona SDK - scene template
View scene-template.lua
-- Include modules/libraries
local composer = require "composer"
-- Variables local to scene
--
-- Create a new Composer scene
local scene = composer.newScene()
View .vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
colorscheme espresso
set cul
hi CursorLine term=none cterm=none ctermbg=234
@tomekc
tomekc / .vimrc
Last active May 25, 2020
Vim awesome plugins
View .vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
set t_Co=256
set background=dark
colorscheme lost-shrine
set cul
@tomekc
tomekc / promises_branching.js
Created Aug 22, 2017
Branching inside promise chain (JavaScript, Bluebirdjs)
View promises_branching.js
var Promise = require('bluebird');
console.log('=== Branching promises demo ===');
function getNameById(id) {
return Promise.resolve("Ziutek");
}
/*
Add missing data to object.
View noise_level_meter.ino
#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;
#define BLINK_LED 16
#define WIFI_LED_PIN 16
#define NUM_MEASURES 1200 // Sampling freq. is 20 hz
View monolity_mikroserwisy.md

Starcie monolitu i mikroserwisów

Obrona monolitu

Artykuł - Dan Haywood: In defence of Monolith Wyważone porównanie obu podejść. Część 2

Monolit musi być dobrze zmodularyzowany by był utrzymywalny. Prawdopodobnie większość monolitów taka nie jest.

Monolit dobrze się sprawdza w złożonej domenie biznesowej, mikroserwisy błyszczą tam, gdzie jest wielka skala.

@tomekc
tomekc / learn_bluebird.js
Last active Mar 15, 2016
Learning playground for Bluebird.js
View learn_bluebird.js
//
// npm install bluebird
// npm install superagent
//
var Promise = require('bluebird');
var request = require('superagent');
console.log('Promises with Bluebird');
function get(url) {
@tomekc
tomekc / CoronaSDK-Module.lua
Created Dec 4, 2015
Creating modules in Corona SDK
View CoronaSDK-Module.lua
local M = {}
function M.create()
-- initialize members: M.foo = "bar"
end
function M.foo()
end
return M
You can’t perform that action at this time.