Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Schweizer verticonaut

  • private
  • Stans, Switzerland
View GitHub Profile
@verticonaut
verticonaut / global-object.js
Created Jan 7, 2021
Declare global object in JS
View global-object.js
class Validator {}
var global = window || global;
global.Validator = Validator;
@verticonaut
verticonaut / .gitconfig
Last active Mar 26, 2020
Global gitconfig file
View .gitconfig
[user]
name = <yourname>
email = <youre email>
[alias]
co = checkout
unpushed = diff origin/master..HEAD --name-status
rpo = remote prune origin
notmerged = branch --no-merged
merged = branch --merged
[color]
View mv_many_files
for f in huk/*.*; do mv "$f" ./; done
View pry-cheatsheet
Pry Cheat Sheet
Youtube Tutorial 2013
Command Line
pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
pry -r ./config/environment.rb - load your rails into a pry session
Debugger
help ls -- Display command options for pry command ls
ls <Object> -- Show all of the available methods that can be called by an object
View pry-cheatsheet
Pry Cheat Sheet
Youtube Tutorial 2013
Command Line
pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
pry -r ./config/environment.rb - load your rails into a pry session
Debugger
help ls -- Display command options for pry command ls
ls <Object> -- Show all of the available methods that can be called by an object
@verticonaut
verticonaut / port_processes.txt
Created Jul 23, 2018
find processes aon ports
View port_processes.txt
lsof -nP -iTCP:3000 | grep LISTEN
View docker_commands.txt
docker ps
# running docker container
docker stop <contaienrId>
# stop the container
docker images
# list all installed images
# Start containers ==========================================
# REDIS
docker run -it --rm -p 6379:6379 -d --name redis redis:alpine
View docker_commands.txt
docker ps
# running docker container
docker stop <contaienrId>
# stop the container
docker images
# list all installed images
# Start containers ==========================================
# REDIS
docker run -it --rm -p 6379:6379 -d --name redis redis:alpine
@verticonaut
verticonaut / property_struct.rb
Last active Dec 19, 2015
Read and write in property style. Sample: ps = PropertyStruct.new; p['a1.a2.a3']=3 ps['a1'] = #<PropertyStruct:...> ps['a1.a2.a3'] = 3
View property_struct.rb
class PropertyStruct
def initialize(nil_safe = true)
@nil_safe = !!nil_safe
@data = {}
end
def [](attribute)
result = @data
View sample_code.rb
# ************************************************************************************************
# *** Mergin with ghostscript
# ************************************************************************************************
GhostScript = `which gs`.chomp
dir = Rails.root.join('tmp').to_s
file_names = [
'2013_01_24_Pfandhalterschaft_DE.pdf',
'2013_01_24_Passivitaetserklaerung_DE.pdf',