Skip to content

Instantly share code, notes, and snippets.

View margusmartsepp's full-sized avatar
😇
It is that simple

Margus Martsepp margusmartsepp

😇
It is that simple
  • Gunvor SA
  • Tallinn
View GitHub Profile
@margusmartsepp
margusmartsepp / certtest.cs
Created January 26, 2016 16:30
cert test
static void Main(string[] args)
{
string testPhrase = "test123";
string hash = SignCertificate(testPhrase);
Console.WriteLine(Verify(testPhrase, hash));
Console.Read();
}
private static string SignCertificate(string text)
{
@margusmartsepp
margusmartsepp / app.js
Created November 30, 2015 08:56
angular
var mainApp = angular.module("mainApp", ["flickrControllers", "flickrServices", "HttpCallsApp", "angular-logger"]);
var ApplicationNamespace = ApplicationNamespace || {};
mainApp
.config(function (logEnhancerProvider) {
logEnhancerProvider.datetimePattern = "HH:mm:ss.SSS";
})
.run(function ($log) {
ApplicationNamespace.Util = {
delay: (function () {
var timers = {};
@margusmartsepp
margusmartsepp / gist:bf64cd645fe80e017765
Created November 12, 2015 14:40
fluent nunit tests
[TestFixture]
public class RepresentativeServiceTests
{
public class TestStory
{
public class Fail
{
public static IEnumerable Constructor
{
get
@margusmartsepp
margusmartsepp / Pivot.cs
Created November 6, 2015 15:21
Get data from gist
private static string _pass = "***";
private static string _user = "margus.martsepp@agileworks.eu";
private static string _puri = "https://www.pivotaltracker.com/n/projects/1155920";
[Test]
public void ReadPivot()
{
using (var d = new ChromeDriver())
{
d.Navigate().GoToUrl(_puri);
d.FindElement(By.Id("credentials_username")).SendKeys(_user);
[%{AdOceanId}
[%{!NoBlock}
<div class="bannerwrap [%{LeftSide=1} col-sm-6 pull-left%|%[%{RightSide=1} col-sm-6 pull-right%]%] [%{Mobile=0}hidden-xs%] [%{Desktop=0} visible-xs-block%][%{Panorama=1}panorama %][%{PageBreak=1}page-break-container %] <%BlockClass%>">
%]
[%{ShowBanners & ShowBanners=0 | nobanners=1}
<div class="banner [%{Mobile=0}hidden-xs%] [%{Desktop=0}visible-xs-block%]" style="[%{Height}height:<%Height%>px!important;line-height:<%Height%>px;%]background-color:#C2D3CD;text-align:center;[%{!Panorama}margin-top:15px;%]width:100%;display:block;">
[%{Mobile=1}M%][%{Desktop=1}D%] BANNER, id:<%AdOceanId%>
</div>
@margusmartsepp
margusmartsepp / isemptyfalse.js
Last active October 28, 2015 07:28
adocean example
function adoceanaripaeevhhngrpfgz() {
if (typeof ado==="object") {var _ado_elem = ado.beginCreative({id:'adoceanaripaeevhhngrpfgz', arg:'', isEmpty:0});}
adocean_break_ooiqqvshdw=function() {
var id=document.getElementById('script_ooiqqvshdw');
if (id) { eval("try { id.src = 'http://'; id.text=''; } catch(exception) { }");}};
if(typeof gao === "undefined") gao = {};
if(typeof gao.bbb !== "object") gao.bbb = [];
bbb = {};
bbb.width = "660";
if (specialid == null) {
ado.slave(id, {
myMaster: master
});
} else {
if (specialid != id) {
$(el).attr('id', specialid);
ado.slave(specialid, {
myMaster: master
});
@margusmartsepp
margusmartsepp / call.cs
Last active August 29, 2015 14:27
IB filename
string fullPath = Server.MapPath(FileUploadHelper.formFullPath(id.ToString(), fileUploadType, filename));
public static string formFullPath(Object id, FileUploadType type, Object fileName)
{
return formFullPath(id, type, fileName, false, null);
}
public static string formFullPath(Object id, FileUploadType type, Object fileName, bool needsMapping, HttpServerUtility server)
{
String fullPath = null;
//PM > Install-Package Selenium.WebDriver
//PM > Install-Package Selenium.Support
//PM > Install-Package Selenium.WebDriver.ChromeDriver
public static bool TestTPilet(out TimeSpan time)
{
DateTime date0 = DateTime.Now;
DateTime date1;
using (var driver = new ChromeDriver())
{
[TestMethod]
public void k()
{
var n = 10000000;
var r = new Random();
var listYes = new List<Tuple<double, double>>();
var listNo = new List<Tuple<double, double>>();
for (var i = 0; i < n; i++)
{
var point = Tuple.Create(r.NextDouble(), r.NextDouble());