I hereby claim:
- I am rafaelbernard on github.
- I am rafaelbernard (https://keybase.io/rafaelbernard) on keybase.
- I have a public key ASAhtOpKuJNu6BEpS5Me9dYSddb-YVyO2NZY9sGpZpwSyQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// original clone adapted from https://dev.to/samanthaming/how-to-deep-clone-an-array-in-javascript-3cig | |
// and the example at http://jsben.ch/q2ez1 | |
// | |
// Deep clone written by @obscurerichard https://github.com/obscurerichard | |
const clone = (items) => items.map(item => Array.isArray(item) ? clone(item) : item); | |
// ✅ Nested array NOT affected | |
var src = [1, [2], 3]; | |
var dest = clone(src) | |
// Make some changes |
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']" |
setxkbmap -option caps:escape |
SELECT 'CREATE INDEX ' || table_name || '_' || column_name || ' ON ' || table_schema || '.' || table_name || ' ("' || column_name || '");' | |
FROM information_schema.columns | |
WHERE table_schema = 'public' | |
AND table_name != 'pg_stat_statements' | |
AND table_name != 'pg_buffercache'; |
WITH schema_size AS ( | |
SELECT | |
tab.table_catalog AS database_name, | |
tab.table_schema AS schema_name, | |
tab.table_name, | |
pg_total_relation_size(table_schema || '.' || tab.table_name) AS table_size_total, | |
pg_relation_size(table_schema || '.' || tab.table_name) AS table_size | |
FROM information_schema.tables tab | |
WHERE table_schema NOT IN ('pg_catalog', 'information_schema') | |
), pretty_size AS ( |
<?php | |
public function set_sql_mode( $modes = array() ) { | |
if ( empty( $modes ) ) { | |
/* | |
if ( $this->use_mysqli ) { | |
$res = mysqli_query( $this->dbh, 'SELECT @@SESSION.sql_mode' ); | |
} else { | |
$res = mysql_query( 'SELECT @@SESSION.sql_mode', $this->dbh ); | |
}*/ | |
$res = ''; |
<?php | |
# at pg4wp_rewrite | |
# right after `Fix tables listing` | |
// Rewriting SHOW FULL COLUMN | |
elseif( 0 === strpos($sql, 'SHOW FULL COLUMN')) | |
{ | |
$logto = 'SHOWFULL'; | |
$sql = str_replace( 'SHOW FULL COLUMNS FROM ', 'SELECT column_name FROM information_schema.columns WHERE table_name = ', $sql); | |
$sql = str_replace( '`', "'", $sql ); |
SELECT w.locktype AS waiting_locktype,w.relation::regclass AS waiting_table,w.transactionid | |
, substr(w_stm.query,1,20) AS waiting_query | |
, w.mode AS waiting_mode,w.pid AS waiting_pid,other.locktype AS other_locktype | |
,other.relation::regclass AS other_table,other_stm.query AS other_query | |
,other.mode AS other_mode,other.pid AS other_pid,other.granted AS other_granted | |
FROM pg_catalog.pg_locks AS w | |
JOIN pg_catalog.pg_stat_activity AS w_stm ON (w_stm.pid = w.pid) | |
JOIN pg_catalog.pg_locks AS other | |
ON ((w.database = other.database AND w.relation = other.relation) OR w.transactionid = other.transactionid) |
<?php | |
// you can write to stdout for debugging purposes, e.g. | |
// print "this is a debug message\n"; | |
function solution($A) { | |
// write your code in PHP5.5 | |
$A = array_unique($A); | |
$count = count($A); | |
if ($count < 1) return 1; |