Skip to content

Instantly share code, notes, and snippets.

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 Nov 13, 2019
Download super-dark-mode for chrome
View super-dark-mode-global-override.md

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 Oct 2, 2019
list of all known peer dependencies in npm
View list-of-all-known-peerDependencies-in-npm.md

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).

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

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

View gist:55914770b0d94c14b04f3397af363551
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
View 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 Dec 12, 2017
TABLE Country PostgreSQL
View country_pgsql.sql
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 Nov 5, 2017 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
View parse_yaml.sh
#!/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]}}
View ManagerDetails.java
public interface ManagerDetails {
String getLogin();
void setLogin(String login);
List<? extends Object> getRoleList();
void setRoleList(List<? extends Object> roleList);