Skip to content

Instantly share code, notes, and snippets.

View gsscoder's full-sized avatar
💭
obsessive coding disorder

coder (π³) gsscoder

💭
obsessive coding disorder
View GitHub Profile
@gotohr
gotohr / gist:7005197
Created October 16, 2013 09:36
declarative function composition - golang
package main
import "fmt"
type F func(i int) int
func (f F) compose(inner F) F {
return func(i int) int { return f(inner(i)) }
}
@JulianBirch
JulianBirch / delta.rb
Created January 13, 2011 17:42
Dusty.rb
### This assumes that appsettings configurationpath was equal to delta.rb
ext "fixConnection" do
senderCompId "IOM"
targetCompId "JEFNET"
heartbeatInterval 60
reconnectInterval 1
protocolVersion "FIX.4.2"
shouldCheckLatency false
isInitiator true
@teeaich
teeaich / sp_logout
Created September 2, 2013 08:01
sharepoint logout url
http://yoursite/_layouts/closeConnection.aspx?loginasanotheruser=true
@devhawk
devhawk / colorconsole.fs
Created August 4, 2016 17:19
F# Color Console Functions
open System
// helper function to set the console collor and automatically set it back when disposed
let consoleColor (fc : ConsoleColor) =
let current = Console.ForegroundColor
Console.ForegroundColor <- fc
{ new IDisposable with
member x.Dispose() = Console.ForegroundColor <- current }
// printf statements that allow user to specify output color
@aidapsibr
aidapsibr / nuget-cache-projects.yml
Created January 20, 2020 10:47
Example using actions/cache to create a cache for all nuget packages based on project files (assumes PackageReference is used)
- uses: actions/cache@v1
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files
restore-keys: |
${{ runner.os }}-nuget-
@Tofunmi1
Tofunmi1 / README.md
Created July 31, 2022 20:22
Bubble sort algorithm in yul

Recursive Implementation Of Bubble Sort in solidity and yul

***credit -> geekforgeeks -> https://www.geeksforgeeks.org/bubble-sort/

The idea is to place the largest element at their position and keep doing the same for every other elements.

Approach:

Place the largest element at their position, this operation makes sure that first largest element will be placed at the end of array. Recursively call for rest n – 1 elements with same operation and placing the next greater element at their position. Base condition for this recursion call would be, when number of elements in the array becomes 0 or 1 then, simply return (as they are already sorted).

@frankhu-2021
frankhu-2021 / PrettifyJSON
Last active January 19, 2023 13:19
PrettyPrint JSON with .NET using Newtonsoft.Json
using Newtonsoft.Json;
public static string JsonPrettify(string json)
{
using (var stringReader = new StringReader(json))
using (var stringWriter = new StringWriter())
{
var jsonReader = new JsonTextReader(stringReader);
var jsonWriter = new JsonTextWriter(stringWriter) { Formatting = Formatting.Indented };
jsonWriter.WriteToken(jsonReader);
@niik
niik / CryptoRandom.cs
Created June 9, 2011 21:48
Buffered CryptoRandom implementation based on Stephen Toub and Shawn Farkas' CryptoRandom
/*
* Original version by Stephen Toub and Shawn Farkas.
* Random pool and thread safety added by Markus Olsson (freakcode.com).
*
* Original source: http://msdn.microsoft.com/en-us/magazine/cc163367.aspx
*
* Some benchmarks (2009-03-18):
*
* Results produced by calling Next() 1 000 000 times on my machine (dual core 3Ghz)
*
@bryanbarnard
bryanbarnard / SimpleHttpClient.cs
Created December 23, 2013 19:15
Simple C# .NET 4.5 HTTPClient Request Using Basic Auth and Proxy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
@subhodi
subhodi / QuickSort.sol
Created December 14, 2017 08:31
Quick sort in Solidity for Ethereum network
pragma solidity ^0.4.18;
contract QuickSort {
function sort(uint[] data) public constant returns(uint[]) {
quickSort(data, int(0), int(data.length - 1));
return data;
}
function quickSort(uint[] memory arr, int left, int right) internal{