Skip to content

Instantly share code, notes, and snippets.

Tomek Cejner tomekc

Block or report user

Report or block tomekc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tomekc / ps-export-layers-to-png.jsx
Created Jun 7, 2012
Photoshop script that exports to PNG all layers and groups whose names end with ".png".
View ps-export-layers-to-png.jsx
#target photoshop
// $.level = 2;
* Script by Tomek Cejner (tomek (at) japko dot info)
* based on work of Damien van Holten:
* My version adds support of nested layer groups,
* and exports single layers in addition to groups.
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()
tomekc / .vimrc
Last active Sep 12, 2019
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
View .vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
colorscheme espresso
set cul
hi CursorLine term=none cterm=none ctermbg=234
tomekc / AppDelegate.swift
Created Jan 9, 2015
CoreData snippet to add to existing project
View AppDelegate.swift
// MARK: - Core Data stack
lazy var applicationDocumentsDirectory: NSURL = {
// The directory the application uses to store the Core Data store file. This code uses a directory named "net.japko.EmptyCoreDataSwiftProject" in the application's documents Application Support directory.
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
return urls[urls.count-1] as NSURL
lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
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

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 / Optional+getOrElse.swift
Last active Oct 28, 2016
Add .getOrElse() method to Swift's Optional<T>, to unwrap value with fallback to default value. Idea borrowed from Scala language.
View Optional+getOrElse.swift
// An extension to Optional type:
// getOrElse() will return optional's value if exists, otherwise the default value provided as argument will be returned.
// Note: Since Xcode6 beta 5, you can use '??' operator.
// (c) Tomek Cejner 2014
// @tomekcejner
extension Optional {
func getOrElse(val:T) -> T {
if self != nil {
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) {
You can’t perform that action at this time.