Skip to content

Instantly share code, notes, and snippets.

View marcinbiegun's full-sized avatar
💭
🤔

Marcin Biegun marcinbiegun

💭
🤔
View GitHub Profile
@marcinbiegun
marcinbiegun / unity.md
Last active April 25, 2020 13:20
Unity #unity

Instantiate GameObject

GameObject player = Instantiate(playerPrefab, spawnPoint.position, spawnPoint.rotation);

UniRx publish

MessageBroker.Default.Publish(new PlayerControlEvent
@marcinbiegun
marcinbiegun / devops.md
Last active December 17, 2018 09:25
Snuppets: DevOps

Renew letsencrypt cert

sudo service nginx stop
sudo certbot renew
sudo service nginx start

generate new letsencrypt cerft

@marcinbiegun
marcinbiegun / bender.md
Created September 5, 2018 07:52
Blender tips

Cursor to center

shift+s and then "Cursor to center"

@marcinbiegun
marcinbiegun / migration.rb
Created July 6, 2018 08:57
Rocketchat migration
#
# This script reads dumped MongoDB tables (as json)
# and posts them to new server via API.
#
require 'rubygems'
require 'json'
require 'rocketchat'
USERS_JSON_FILE = 'users.json'
@marcinbiegun
marcinbiegun / snippets-shell.md
Created June 16, 2018 09:02
Snippets: Shell

Compare files recursively:

$ cd phpcode
$ diff -rq comments_new comments_old
Only in comments_new: config.php
Only in comments_old: config_old.php
Only in comments_old: functions.inc
@marcinbiegun
marcinbiegun / javascript-snippets.md
Last active June 15, 2018 17:54
Snippets: JavaScript

Lodash function composition:

import fp from 'lodash/fp';
const data = [ /* data here **/ ];
const formatPhone = c => ({
  ...c,
  phone: `(${c.phone.slice(0, 2)})${c.phone.slice(3, 5)-${c.phone.slice(6)}}`
});
const formatData = fp.compose(
@marcinbiegun
marcinbiegun / elixir-phoenix-snippets.md
Last active November 8, 2018 12:51
Snippets: Elixir & Phoenix

Elixir

Get remote file content (no libs)

Application.ensure_all_started(:inets)
Application.ensure_all_started(:ssl)
{:ok, {{'HTTP/1.1', 200, 'OK'}, _headers, body}} = :httpc.request(:get, {'http://google.com', []}, [], [])
@marcinbiegun
marcinbiegun / replace.rb
Created June 4, 2018 11:47
Recursively replace strings with locale keys in code files (Ruby, Coffee, JavaScript)
#!/usr/bin/env ruby-2.0.0-p353@global
# the script
# - expects the translation text to come in STDIN
# - expects the translation text to be single or multiline
# - prints the translation handlebars invokation to STDOUT
# - add entry to all locales/*/MODULE.json files
#
# example VIM visual mode mapping for specific module and namespace
# fully automatic:
@marcinbiegun
marcinbiegun / wonsz.rb
Created June 4, 2018 11:39
Wonsz.rb - a simple snake game remake
#
# Wonsz (aka Snek) - a simple remake of oldschool snake game.
#
# This is a result of evening coding with non-programmers.
# The code is procedural, it uses only basic Ruby features.
#
# Config