Skip to content

Instantly share code, notes, and snippets.

View binki's full-sized avatar

Nathan Phillip Brink binki

View GitHub Profile
@binki
binki / Program.cs
Created January 18, 2017 20:50
VS default C# .net Console app template
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
@binki
binki / Program.cs
Created January 25, 2017 20:06
Haxe Interpolated String Example
using System;
using System.Linq;
class Program
{
static void Main(string[] args)
{
intr($"asdf{""}{"bsdf"}"); // Format=asdf{0}{1}, Arguments=“”,“bsdf”
intr($"asdf{""}bsdf"); // Format=asdf{0}bsdf, Arguments=“”
}
@binki
binki / output.txt
Created January 31, 2017 03:39
Reading unicode CSV
C:\Users\ohnob>.\readUnicodeCsv.py
勇気
@binki
binki / BinkiBinarySearch.hx
Last active February 1, 2017 14:38
Binary search attempt
class BinkiBinarySearch {
/**
Input: `arr` is a sorted array, `sought` is a sought value,
`cmp` a comparer which when called like `cmp(a, b)` returns -1
if `a` comes before `b`, 0 if `a` and `b` are of the same
order, and 1 if `a` comes after `b`.
Returns: -1 if something equivalent to `sought` is not found,
index of any element matching `sought` otherwise.
**/
@binki
binki / py_except_speed.py
Last active February 13, 2017 16:35
if is faster than try?
#!/usr/bin/env python3
from os.path import dirname, realpath
import sys
from timeit import Timer
sys.path.append(dirname(realpath(__file__)))
def ifway3(b):
a=1
if not b == 0:
@binki
binki / Program.cs
Created March 14, 2017 17:14
Local function can capture like normal
using System;
namespace LocalFuncCreatesClass
{
class Program
{
static Func<int> GetNextThing { get; set; }
static void Main(string[] args)
{
var current = 2;
@binki
binki / Program.cs
Created March 14, 2017 17:21
capture still works
using System;
namespace LocalFuncCreatesClass
{
class Program
{
static Func<int> GetNextThing { get; set; }
static void Main(string[] args)
{
SeparateFunction();
@binki
binki / DecompiledProgram.cs
Created March 14, 2017 17:29
local method no lamdba decompiled
using System;
using System.Runtime.CompilerServices;
namespace LocalFuncCreatesClass
{
internal class Program
{
private static Func<int> GetNextThing
{
get;
@binki
binki / SQLQuery28.sql
Created March 28, 2017 17:52
Why doesn’t @@TRANCOUNT increment after my IF statement?
SET IMPLICIT_TRANSACTIONS ON
GO
IF OBJECT_ID('dbo.t1') IS NOT NULL
BEGIN
DROP TABLE dbo.t1
COMMIT
END
GO
CREATE TABLE dbo.t1 (x INT);
GO
@binki
binki / blah.py
Created March 28, 2017 19:05
How to ask python to stay open after running a script
#!/usr/bin/env python3
my_var = 23