Skip to content

Instantly share code, notes, and snippets.

@tomekc
tomekc / ps-export-layers-to-png.jsx
Created June 7, 2012 22:21
Photoshop script that exports to PNG all layers and groups whose names end with ".png".
#target photoshop
// $.level = 2;
/*
* Script by Tomek Cejner (tomek (at) japko dot info)
* based on work of Damien van Holten:
* http://www.damienvanholten.com/blog/export-groups-to-files-photoshop/
*
* My version adds support of nested layer groups,
* and exports single layers in addition to groups.
@tomekc
tomekc / git_tricks.sh
Created January 10, 2023 10:46
Git tricks
# List all branches with commit date and committer
git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname)|%(committerdate)|%(authorname)'
@tomekc
tomekc / instalacja nowego maca.md
Created May 31, 2022 21:12
Cheat sheet guide to setup new Mac:
@tomekc
tomekc / makefile_help.md
Created May 17, 2022 09:53
Makefile help

Default "help" target in Makefile

GREEN  := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE  := $(shell tput -Txterm setaf 7)
RESET  := $(shell tput -Txterm sgr0)

.PHONY: help
help: ## Show this help.
@tomekc
tomekc / human_readable_id_base32.go
Last active March 16, 2021 23:32
Build human-readable ID using Base32 in Go
package main
import (
"encoding/base32"
"fmt"
)
func main() {
id := 202790
@tomekc
tomekc / .vimrc
Last active July 9, 2020 12:19
Vim awesome plugins
execute pathogen#infect()
syntax on
filetype plugin indent on
set t_Co=256
set background=dark
colorscheme lost-shrine
set cul
@tomekc
tomekc / database.go
Created July 3, 2020 05:55
Trivial REST API returning contents of database
package main
import (
"context"
"database/sql"
"encoding/json"
_ "github.com/go-sql-driver/mysql"
"net/http"
. "strings"
)
@tomekc
tomekc / nested-for-loops.js
Created February 16, 2020 22:59
Zagnieżdżone pętle for w JavaScripcie
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 December 10, 2019 22:03
Corona SDK - scene template
-- Include modules/libraries
local composer = require "composer"
-- Variables local to scene
--
-- Create a new Composer scene
local scene = composer.newScene()
@tomekc
tomekc / AppDelegate.swift
Created January 9, 2015 00:00
CoreData snippet to add to existing project
// 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.