This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * from ( | |
select | |
key_col | |
,date_col | |
,data_col | |
,prev_data_col = lag(data_col, 1) over (partition by key_col order by date_col) | |
from tbl | |
) as z | |
where prev_data_col is not NULL | |
and data_col <> prev_data_col |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://stackoverflow.com/a/23702332/2370606 | |
select * | |
from sys.objects | |
where modify_date > dateadd(d, -1, getdate()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
key_col | |
,startdate | |
,enddate | |
,change_col | |
from ( | |
select distinct | |
key_col | |
,startdate = min(date_col) over (partition by group_key, key_col) | |
,enddate = max(date_col) over (partition by group_key, key_col) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
namespace Cipher | |
{ | |
public class Rot13 | |
{ | |
public static string Encode(string text) | |
=> new string( | |
text.ToCharArray() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "extra", | |
"version": "1.0.0", | |
"description": "", | |
"main": "test.js", | |
"scripts": { | |
"test": "mocha" | |
}, | |
"author": "Mike Harris", | |
"license": "ISC", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace library | |
{ | |
public class Greed | |
{ | |
public static int Calculate(int [] dice) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using static System.ValueTuple; | |
using Xunit; | |
namespace dotnet | |
{ | |
public class ExampleTests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
fb <- tibble( | |
x = 1:100, | |
fizzable = ifelse(x %% 3 == 0, TRUE, FALSE), | |
buzzable = ifelse(x %% 5 == 0, TRUE, FALSE), | |
formatted = ifelse(fizzable & buzzable, "FizzBuzz", | |
ifelse(fizzable, "Fizz", | |
ifelse(buzzable, "Buzz", | |
x))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sapply(rep(0:100), | |
function(x) | |
if(x %% 15 == 0) "FizzBuzz" | |
else if(x %% 3 == 0) "Fizz" | |
else if(x %% 5 == 0) "Buzz" | |
else x) | |
# based on https://gist.github.com/jangorecki/ef2b908a6ad46a13a5e4 | |
fizzy <- seq(0, 100, 3) | |
buzzy <- seq(0, 100, 5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fizzy <- seq(0, 100, 3) | |
buzzy <- seq(0, 100, 5) | |
fizzbuzzy <- fizzy[fizzy %in% buzzy] | |
fizzbuzz <- 0:100 | |
fizzbuzz[fizzbuzz %in% fizzbuzzy] <- "FizzBuzz" | |
fizzbuzz[fizzbuzz %in% fizzy] <- "Fizz" | |
fizzbuzz[fizzbuzz %in% buzzy] <- "Buzz" |
NewerOlder