I hereby claim:
- I am jonasraoni on github.
- I am jonasraoni (https://keybase.io/jonasraoni) on keybase.
- I have a public key whose fingerprint is C6B8 2A63 2F58 4784 159E 802F 5ECC 07E6 0269 4752
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
/* | |
Twin Strings | |
Two strings, a and b, are said to be twins only if they can be made equivalent by performing some number of operations on one or both strings. There are two possible operations: | |
SwapEven: Swap a character at an even-numbered index with a character at another even-numbered index. | |
SwapOdd: Swap a character at an odd-numbered index with a character at another odd-numbered index. | |
For example, a = "abcd" and b = "cdab" are twins because we can make them equivalent by performing operations. Alternatively, a = "abcd" and b = "bcda" are not twins (operations do not move characters between odd and even indices), and neither are a = "abc" and b = "ab" (no amount of operations will insert a 'c' into string b). | |
Complete the twins function in the provided code. It has two parameters: |
using System; | |
using System.IO; | |
using System.Web; | |
using System.Text; | |
using System.Collections.Generic; | |
using System.Collections; | |
namespace Raoni { | |
public delegate bool Generator<T>(out T value); | |
public delegate bool Enumerator<T>(T value); |
-- find missing indexes | |
SELECT | |
conrelid::regclass, conname, reltuples::bigint | |
FROM | |
pg_constraint | |
JOIN pg_class | |
ON conrelid = pg_class.oid | |
WHERE | |
contype = 'f' | |
AND NOT EXISTS ( |
SELECT | |
C.Table_Name, | |
C.Constraint_Name, | |
C.Constraint_Columns | |
FROM | |
( | |
SELECT | |
object_name(i.object_id) table_name, i.name index_name, | |
MAX(CASE index_column_id when 1 THEN col_name(ic.object_id,ic.column_id) ELSE '' END) + | |
MAX(CASE index_column_id when 2 THEN col_name(ic.object_id,ic.column_id) ELSE '' END) + |
using System; | |
using System.Text.RegularExpressions; | |
namespace Raoni { | |
public static class Utils { | |
private string queryLimit(string query, uint limit, uint? offset) { | |
if(limit > 0) { | |
offset = offset == null ? 0 : offset; | |
if(offset < 0) | |
throw new Exception("LIMIT argument offset=" + offset + " is not valid"); |
Backup = { | |
shell: WScript.CreateObject("WScript.Shell"), | |
base: "C:/BACKUP/", | |
username: "USERNAME", | |
hostname: "HOST", | |
password: "PASSWORD", | |
type: { | |
postgreSQL: function(){ | |
var shell = Backup.shell; | |
var path = "c:/program files/postgresql/9.6/bin/"; |
//+ Jonas Raoni Soares Silva | |
//@ http://raoni.org | |
// Iteration 3: manually minified xD | |
const sum = (...args) => ((v, r = sum.bind(this, v)) => (r[Symbol.toPrimitive] = () => v, r))(args.reduce((a, b) => a + b, 0)); | |
// Iteration 2: supports sum(1,2,3) | |
const sum = (...args) => { | |
const operation = (...args) => args.reduce((a, b) => a + b, 0); | |
let current = operation(...args); |
function print(o){ | |
var | |
m = o.length >> 1, | |
r = m, | |
c = m + 1; | |
p = function(){ | |
console.log(o[r][c]); | |
}, | |
left = function(i){ | |
for(; c > i; p(--c)); |
class Increment{ | |
constructor(value) { | |
this.current = +value || 0; | |
}; | |
[Symbol.toPrimitive]() { | |
return ++this.current; | |
} | |
} | |
var increment = new Increment(); |