Skip to content

Instantly share code, notes, and snippets.

View ifahrentholz's full-sized avatar
👨‍💻
workin

Ingo Fahrentholz ifahrentholz

👨‍💻
workin
View GitHub Profile
@ifahrentholz
ifahrentholz / clean_code.md
Created May 21, 2022 20:05 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@ifahrentholz
ifahrentholz / readme.txt
Created May 23, 2018 20:07
node cms / api tutorials
build-a-cms-api-with-graphql-and-apollo-server
https://blog.manifold.co/build-a-cms-api-with-graphql-and-apollo-server-ae6a5d5c7fb3
sub plGetDeviceType {
my ($szUAgt) = shift;
if (3 >= length($szUAgt)) { return 0; } # unknown
if ($szUAgt =~ /Windows NT/) { return 1; } # desktop
if ($szUAgt =~ /iPad/ || ($szUAgt =~ /Android/i && $szUAgt !~ /mobile/i) || $szUAgt =~ /tablet/i || $szUAgt =~ /iPod/) {
return 2; # tablet
} elsif (($szUAgt =~ /Android/i && $szUAgt =~ /mobile/i) || $szUAgt =~ /CPU iPhone/ || $szUAgt =~ /mobile safari/i || $szUAgt =~ /Windows Phone/i ||
$szUAgt =~ /Opera Mobi/i) {
return 3; # smartphone
@ifahrentholz
ifahrentholz / .js
Created March 17, 2016 12:12
recursive iteration array / object
function eachRecursive(obj) {
for (var k in obj) {
if (typeof obj[k] == "object" && obj[k] !== null)
eachRecursive(obj[k]);
else {
console.log(k);
console.log(obj[k]);
}
}
}
alias gs='git status'
alias gco='git checkout'
alias gc='git commit'
alias grb='git rebase'
alias gb='git branch'
alias ga='git add -A'
alias gpl='git pull'
alias gp='git push'
alias glg='git log --date-order --all --graph --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
alias glg2='git log --date-order --all --graph --name-status --format="%C(green)%H%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
@ifahrentholz
ifahrentholz / cherry-picking.txt
Created November 23, 2015 13:15
Description for the right cherry-pick workflow
Cherry-Picking specific commits from another branch
10 June, 2010 • tagged cherry-pick, git and scm • 323 words • ~2 minutes
I’m often asked how to merge only specific commits from another branch into the current one. The reason you’d want to do this is to merge specific changes you need now, leaving other code changes you’re not interested in right now behind.
First of all, use git log or the awesome GitX tool to see exactly which commit you want to pick. An example:
dd2e86 - 946992 - 9143a9 - a6fd86 - 5a6057 [master]
\
76cada - 62ecb3 - b886a0 [feature]
$dspace: 24px;
$space--xs: round(0.25 * $dspace);
$space--s: round(0.5 * $dspace);
$space--m: round(2 * $dspace);
$space--l: round(4 * $dspace);
@mixin sizes($properties...) {
&--tiny {
@each $property in $properties {
// ---------------------------------
// ---------- Plugin Name ----------
// ---------------------------------
// Brief plugin description
// ------------------------
/*
The semi-colon before the function invocation is a safety net against
concatenated scripts and/or other plugins which may not be closed properly.
alias tma='tmux attach -d -t'
alias git-tmux='tmux new -s $(basename $(pwd))'
alias tksa='tmux kill-session -a'
alias tks='tmux kill-session '
alias tls='tmux list-sessions'
@ifahrentholz
ifahrentholz / gist:7b8eabf12c06a05a664e
Last active August 29, 2015 14:15
Preserve License Comments
uglify: {
options: {
mangle: {
except: ['jQuery']
},
preserveComments: 'some',
banner: '<%= banner %>',
report: 'min'
},
my_targets: {