Skip to content

Instantly share code, notes, and snippets.

View jonny-novikov's full-sized avatar
🎯
Work Anywhere; Enjoy Anytime;

Jonny Novikov jonny-novikov

🎯
Work Anywhere; Enjoy Anytime;
View GitHub Profile
@jonny-novikov
jonny-novikov / gist:6289af322b9fa0be9011
Created February 23, 2015 17:07
C# equivalent to preg_match and preg_replace
/// <summary>
/// .NET C# equivalent to PHP preg_match and preg_replace
/// </summary>
public static class RegexExtensions
{
/// <summary>
/// Equivalent to PHP preg_match but only for 3 requied parameters
/// </summary>
/// <param name="regex"></param>
/// <param name="input"></param>
static void inner_stretch_argb8888_bilinear(Blitter* blitter, const InnerInfo* info)
{
uint32 u = info->ustart;
uint32 vfrac2 = info->vfrac >> 8;
uint32 vfrac1 = 0x100 - vfrac2;
uint32* src1 = reinterpret_cast<uint32*>(info->src);
uint32* src2 = reinterpret_cast<uint32*>(info->src2);
uint32* dest = reinterpret_cast<uint32*>(info->dest);
int count = info->width;
@jonny-novikov
jonny-novikov / P7mVerifyXml.cs
Last active February 24, 2016 22:03
Verify and decrypt p7m-mime
using System;
using System.IO;
using System.Text;
using Org.BouncyCastle.Asn1.Cms;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.X509;
using MimeKit;
using MimeKit.IO;
@jonny-novikov
jonny-novikov / pg_dump_restore.sh
Created August 25, 2016 19:56
Postgresql dump and restore
#take full dump
pg_dump -i -U user_name -F t -b -v -f "prod.backup" db_name
#restore specific table
pg_restore -i -U user_name -d db_name -t table_name -v "prod.backup"
@jonny-novikov
jonny-novikov / apgdiff.sh
Created August 25, 2016 19:57
Takes Postgresql schema dump and runs apgdiff tool to save the diff in a file.
pg_dump -U perkdsp -svf "production_schema.sql" perkdsp
pg_dump -U perkdsp -svf "staging_schema.sql" perkdsp_staging
java -jar apgdiff-2.4.jar production_schema.sql staging_schema.sql > diff.sql

#Open Source Laravel Projects

using System;
public string GetResult(int number) {
if (number % 3 == 0) {
if (number % 5 == 0) return "fizzbuzz";
return "fizz";
}
if (number % 5 == 0) return "buzz";
return number.ToString();
}

Keybase proof

I hereby claim:

  • I am jonny-novikov on github.
  • I am jonnynovikov (https://keybase.io/jonnynovikov) on keybase.
  • I have a public key ASDFtpHO2Wc2KojprgQNwFswYgb7mvK2oT1lOG1-NgEL5go

To claim this, I am signing this object:

@jonny-novikov
jonny-novikov / how-to-use.cs
Last active May 17, 2018 08:58
Run task in periodic manner
RunPeriodicAsync(() => { Console.WriteLine("Tick once a minute!"); }, TimeSpan.Zero, TimeSpan.FromMinutes(1), default(CancellationToken));
@jonny-novikov
jonny-novikov / Insert Image.yaml
Created August 19, 2018 21:29
Inserts an image to the current slide. - Shared with Script Lab
name: Insert Image
description: Inserts an image to the current slide.
author: jonny-novikov
host: POWERPOINT
api_set: {}
script:
content: |
$('#insert').click(run);
function run() {