Skip to content

Instantly share code, notes, and snippets.

View kopax's full-sized avatar
🎅
while true; do code; done;

Dimitri KOPRIWA kopax

🎅
while true; do code; done;
View GitHub Profile
@kopax
kopax / super-dark-mode-global-override.md
Last active November 13, 2019 12:00
Download super-dark-mode for chrome

Download Google Chrome super-dark-mode extension extensions.

Add the following global CSS to configuration:

/* GitHub */
.comment-body {
  color: #e2e2e2;
}
@kopax
kopax / list-of-all-known-peerDependencies-in-npm.md
Last active October 2, 2019 13:43
list of all known peer dependencies in npm

list of all known peer dependencies in npm

Because some dependencies are stateful, they cannot be present twice in the dependency tree hierarchy. It can be considered as singleton dependency.

This gist aim to list all known singleton dependency to help developers write better packages.

peerDependencies must not be installed in dependencies only when you are writing a module. (people will install in their application, and install those peerDependencies their self).

export default ({
dataProvider,
history,
customReducers = {},
authProvider = null,
customSagas = [],
i18nProvider = defaultI18nProvider,
initialState,
locale = 'en',
@kopax
kopax / array_iteration_thoughts.md
Created February 24, 2019 04:34 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

cat > mka.ldif << EOL
dn: uid=pnn,ou=users,o=myorg,dc=example,dc=com
changetype: modify
replace: mail
mail: phong.nguyen@example.com
-
EOL
ldapmodify -H ldapi:/// -x -W -D cn=admin,dc=example,dc=com -f mka.ldif
@kopax
kopax / wrap.js
Created May 24, 2018 15:22
wrap.js
if (filesToCommit.length > 0) {
logger.log('Found %d file(s) to commit', filesToCommit.length);
await add(filesToCommit);
debug('commited files: %o', filesToCommit);
const skipCi = temporaryBranch && temporarySkipCi ? '' : '[skip ci]';
await commit(
message
? template(message)({branch, lastRelease, nextRelease})
: `chore(release): ${nextRelease.version} ${skipCi}\n\n${nextRelease.notes}`
@kopax
kopax / country_pgsql.sql
Created December 12, 2017 15:51
TABLE Country PostgreSQL
CREATE TABLE "um_country" (
"id" BIGSERIAL NOT NULL,
"iso" VARCHAR(45) DEFAULT NULL,
"iso3" VARCHAR(45) DEFAULT NULL,
"fips" VARCHAR(45) DEFAULT NULL,
"name" VARCHAR(45) DEFAULT NULL,
"continent" VARCHAR(45) DEFAULT NULL,
"currency_code" VARCHAR(45) DEFAULT NULL,
"currency_name" VARCHAR(45) DEFAULT NULL,
@kopax
kopax / parse_yaml.sh
Created November 5, 2017 17:34 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
public interface ManagerDetails {
String getLogin();
void setLogin(String login);
List<? extends Object> getRoleList();
void setRoleList(List<? extends Object> roleList);