Skip to content

Instantly share code, notes, and snippets.

View rudilee's full-sized avatar

Rudi rudilee

View GitHub Profile
-- DateDiff function that returns the difference between two timestamps in the given date_part (weeks, months, etc) as an integer
-- This behaves like the DateDiff function in warehouses like Redshift and Snowflake, which count the boundaries between date_parts
CREATE OR REPLACE FUNCTION datediff (date_part VARCHAR(30), start_t TIMESTAMP, end_t TIMESTAMP)
RETURNS INT AS $diff$
DECLARE
years INT = 0;
days INT = 0;
hours INT = 0;
minutes INT = 0;
-- DateDiff function that returns the difference between two timestamps in the given date_part (weeks, months, etc) as an integer
-- This behaves like the DateDiff function in warehouses like Redshift and Snowflake, which count the boundaries between date_parts
CREATE OR REPLACE FUNCTION datediff (date_part VARCHAR(30), start_t TIMESTAMP, end_t TIMESTAMP)
RETURNS INT AS $diff$
DECLARE
years INT = 0;
days INT = 0;
hours INT = 0;
minutes INT = 0;
Future<bool> testAsync1() async {
throw Exception('From test 1');
}
Future<bool> testAsync2() async {
try {
await testAsync1();
throw Exception('From test 2');
} finally {}
@rudilee
rudilee / keybase.md
Created September 23, 2014 23:26
Keybase Proof

Keybase proof

I hereby claim:

  • I am rudilee on github.
  • I am rudilee (https://keybase.io/rudilee) on keybase.
  • I have a public key whose fingerprint is 613B B81C 4CE2 208D 2A28 FB36 3D07 6BC1 AF6C 45B5

To claim this, I am signing this object:

function solution(str){
var result = [], length = str[0].length;
for (var i = 0; i < Math.floor(length / 2); i++) result.push(str[0].slice(i * 2, i * 2 + 2));
if ((length % 2) == 1) result.push(str[0][length - 1] + '_');
return result;
}