Skip to content

Instantly share code, notes, and snippets.

@tomaszj
tomaszj / tomaszj-colemak.json
Created May 12, 2022 01:08
QMK Configurator JSON
{
"version": 1,
"documentation": "This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\n",
"keyboard": "redox_w",
"keymap": "tomaszj-colemak",
"layout": "LAYOUT",
"layers": [
[
"LT(2,KC_GRV)",
"KC_1",
@tomaszj
tomaszj / poodir-notes.md
Created June 2, 2018 23:43 — forked from speric/poodir-notes.md
Notes From "Practical Object-Oriented Design In Ruby" by Sandi Metz

Chapter 1 - Object Oriented Design

The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.

SOLID Design:

  • Single Responsibility Principle: a class should have only a single responsibility
  • Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
  • Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
@tomaszj
tomaszj / gimp_script.py
Last active May 25, 2022 14:26
Script that can be pasted into GIMP's Python-Fu console to generate multiple files with names from the array.
names = [
"Ada Lovelace",
"John Smith",
"Sam Kowalski"
]
original_image = gimp.image_list()[0]
for name in names:
first_name, last_name = name.split(" ")
@tomaszj
tomaszj / gist:11094658
Created April 19, 2014 19:19
Controller public/protected methods
irb(main):002:0> PostsController.new.methods
=> [:index, :show, :new, :edit, :create, :update, :destroy, :_routes, :rails_mailers_path, :rails_mailers_url, :rails_info_properties_path, :rails_info_properties_url, :rails_info_routes_path, :rails_info_routes_url, :rails_info_path, :rails_info_url, :posts_path, :posts_url, :new_post_path, :new_post_url, :edit_post_path, :edit_post_url, :post_path, :post_url, :_view_paths, :_view_paths?, :_view_paths=, :asset_host, :asset_host=, :assets_dir, :assets_dir=, :javascripts_dir, :javascripts_dir=, :stylesheets_dir, :stylesheets_dir=, :default_asset_host_protocol, :default_asset_host_protocol=, :relative_url_root, :relative_url_root=, :_helpers, :_helpers?, :_helpers=, :_helper_methods, :_helper_methods?, :_helper_methods=, :helpers_path, :helpers_path?, :helpers_path=, :include_all_helpers, :include_all_helpers?, :include_all_helpers=, :hidden_actions, :hidden_actions?, :hidden_actions=, :default_url_options, :default_url_options?, :default_url_options=, :logger, :logg
@tomaszj
tomaszj / gist:3126195
Created July 17, 2012 00:47
Delete form example
<form action="/articles/<%= @article.id %>" method="post">
<input type="hidden" name="_method" value="delete" />
<input type="submit" value="Delete">
</form>
@tomaszj
tomaszj / gist:3047703
Created July 4, 2012 14:39
Block example
// In the project far, far away...
// .h
typedef void(^SuccessBlock)();
typedef void(^FailureBlock)(NSString *errorMessage);
- (void)executeCommandWithSuccessBlock:(SuccessBlock)successBlock failureBlock:(FailureBlock)failureBlock;
// usage
[someCommand executeCommandWithSuccessBlock:^{
@tomaszj
tomaszj / gist:3046420
Created July 4, 2012 09:48
Properties examples
// Situation 1:
// .h
@property (nonatomic, strong) YourObject *yourObject;
// .m
@synthesize yourObject;
// Situation 2: