Skip to content

Instantly share code, notes, and snippets.

View Parables's full-sized avatar
💭
Contributing to Open Source projects... #GivingBack2éCommunity

Parables Boltnoel Parables

💭
Contributing to Open Source projects... #GivingBack2éCommunity
  • Ghana
View GitHub Profile
@Parables
Parables / nested_value_henlpers.ts
Last active June 4, 2021 06:13
Set a deeply nested value or get the value of a deeply nested key using dot-separated-string path. E.g: 'some.deeply.nested.key'
let data: Record<string, any> = { initial: "something" }
let key = "root.field.subField"
const setNestedValue = (obj: Record<string, any>, path: string, value) => {
return path.split(".")
.reduce((acc, cur, index, arr) => index === arr.length - 1 ? acc[cur] = value : acc[cur] = {}, obj)
}
const getNestedValue = (obj: Record<string, any>, path: string, defaultValue?: any) =>
@Parables
Parables / monads.ts
Created June 5, 2021 09:14
Monads using null. Clever tricky by Nathan Franck http://disq.us/p/266tez0
function getSupervisorName(enteredId: string | null) {
let employee, supervisor;
if (null != enteredId &&
null != (employee = repository.findById(parseInt(enteredId))) &&
null != employee.supervisorId &&
null != (supervisor = repository.findById(employee.supervisorId)))
return supervisor.name;
}
@Parables
Parables / monads.ts
Created June 5, 2021 09:14
Monads using null. Clever tricky by Nathan Franck http://disq.us/p/266tez0
function getSupervisorName(enteredId: string | null) {
let employee, supervisor;
if (null != enteredId &&
null != (employee = repository.findById(parseInt(enteredId))) &&
null != employee.supervisorId &&
null != (supervisor = repository.findById(employee.supervisorId)))
return supervisor.name;
}
#Option 1
set -U fish_user_paths /usr/local/bin $fish_user_paths
#option 2
set PATH $PATH /usr/local/bin
export PATH
function ll
ls -lh $argv
end
@Parables
Parables / fish_alias.md
Created June 12, 2021 03:26 — forked from tikolakin/fish_alias.md
Create alias in Fish shell and save this as a permanent function

Directly from CLI

alias x='exit'
funcsave x

or create a file in

~/.config/fish/functions 

with name

@Parables
Parables / .vscode--extensions.json
Last active October 15, 2024 14:35
VS Code Laravel Recommended Extensions
{
"recommendations": [
"aaron-bond.better-comments",
"adpyke.codesnap",
"adrianwilczynski.alpine-js-intellisense",
"ahinkle.laravel-model-snippets",
"ahmadawais.shades-of-purple",
"aibnuhibban.laravel-smart-command",
"alefragnani.project-manager",
"amiralizadeh9480.laravel-extra-intellisense",
@Parables
Parables / updateVSCodeExtensionsInstallationScript.sh
Created June 26, 2021 01:30 — forked from gingerpaledale/updateVSCodeExtensionsInstallationScript.sh
Export Installed Visual Studio Code Extensions in a Form of Installation Script
#!/usr/bin/env zsh
#
# This script generates and writes to file another bash-script (output_script)
# that implements "vscodeInstallExtensions" function which installs all
# Visual Studio Code extensions that were originally installed on your machine
# at the moment of generation output_script by running
# "vscodeUpdateExtensionsInstallationScript" function that is implemented here below.
#
# # How to use
#
@Parables
Parables / phpcs.xml
Created June 26, 2021 14:25 — forked from paulund/phpcs.xml
PHP PSR-2 CodeSniffer Config for Laravel
<?xml version="1.0"?>
<ruleset name="Laravel Standards">
<!--
The name attribute of the ruleset tag is displayed
when running PHP_CodeSniffer with the -v command line
argument. The description tag below is not displayed anywhere
except in this file, so it can contain information for
developers who may change this file in the future.
-->
@Parables
Parables / phpcs.xml
Created September 11, 2021 17:47
My custom version
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>PHPCS configuration file.</description>
<!-- check all files in the app directory, feel free to add more files with:
<file>FOLDER NAME</file>
-->
<file>app</file>
<file>bootstrap</file>
@Parables
Parables / flutter-persmissions.md
Last active October 19, 2021 09:38
flutter arch-linux permissions

Permissions for Flutter

Flutter was installed on /opt/flutter

If you intend to use it as a regular user, add your user into the group flutterusers:

gpasswd -a <user> flutterusers

You need to source /etc/profile or relogin to add flutter to your path.