This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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 | |
cast(use2.usename as varchar(50)) as owner, | |
pgc.oid, | |
trim(pgdb.datname) as Database, | |
trim(pgn.nspname) as Schema, | |
trim(a.name) as Table, | |
(b.mbytes / 1024) gbytes, | |
a.rows, | |
((case when a.rows > 0 then b.mbytes / a.rows::real end) * 1024) kb_per_row, | |
round(b.mbytes / (sum(b.mbytes) over ())::real * 100, 4) pct_of_cluster |
This file contains 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
/* lexical grammar */ | |
%lex | |
%% | |
\s+ /* skip whitespace */ | |
[0-9]+("."[0-9]+)?\b return 'NUMBER' | |
"+" return '+' | |
<<EOF>> return 'EOF' | |
. return 'INVALID' |
This file contains 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
warehouse=# CREATE VIEW events.events AS SELECT * FROM events.a UNION SELECT * FROM events.b; | |
CREATE | |
warehouse=# CREATE VIEW events.events AS SELECT * FROM events.a UNION ALL SELECT * FROM events.b; | |
CREATE |
This file contains 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
>>> weight | |
10 | |
>>> a | |
[1, 2, 3] | |
# ok, we have a nice list here. let's apply a map() to see if we can raise the power of all values: | |
>>> map((lambda x: x**2), a) | |
[1, 4, 9] |
This file contains 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
public static class StatsTools | |
{ | |
private static double StdDevInternal<T>(this IEnumerable<T> Self, Func<T, double> Selector, Func<double, long, double> FinalStep) | |
{ | |
double ret = 0.0, mean = 0.0; | |
long n; | |
mean = Self.Mean(Selector, out n); | |
foreach (var item in Self) |
This file contains 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
Mapper.CreateMap<CacheObjects.CreditDefaultSwapPrice, CDSSettlementData>() | |
.ForMember(dest => dest.ProductKey, opt => opt.MapFrom(src => src)) | |
.ForMember(dest => dest.Settlements, opt => opt.MapFrom(src => src.Settlements)) | |
.AfterMap((src, dest) => | |
{ | |
if (dest.Settlements != null) | |
{ | |
foreach (var settlement in dest.Settlements) | |
{ | |
settlement.OpenInterest = src.OpenInterest; |
This file contains 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; | |
using Tamir.SharpSsh; | |
using Tamir.SharpSsh.jsch; | |
namespace FileService | |
{ | |
/// <summary> |
This file contains 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
<?php | |
class Test { | |
public function What() { echo "What?"; } | |
} | |
// Fine | |
$a = new Test(); | |
$a->What(); | |
// This breaks |
This file contains 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
var dict = new Dictionary<int, int>() { {1, 1}, {2, 2}, {3, 3}}; | |
var list = from record in dict.Keys | |
where record > 1 | |
select record; | |
foreach (var item in list) | |
{ | |
dict.Remove(item); | |
} |
OlderNewer