Skip to content

Instantly share code, notes, and snippets.

View NicoJuicy's full-sized avatar

Nico Sap NicoJuicy

View GitHub Profile
@loilo
loilo / split-pull-requests.md
Last active April 3, 2024 07:24
Split a large pull request into two
@emptyother
emptyother / MyExtensions.linq
Last active November 10, 2021 16:18
Linqpad extensions
<Query Kind="Program">
<NuGetReference>Newtonsoft.Json</NuGetReference>
<Namespace>Newtonsoft.Json</Namespace>
<Namespace>System.Globalization</Namespace>
</Query>
void Main()
{
// Write code to test your extensions here. Press F5 to compile and run.
}
@myshov
myshov / function_invocation.js
Last active January 21, 2024 15:14
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@W4RH4WK
W4RH4WK / FSM.cs
Last active April 28, 2024 08:55
C# Generic Finite State Machine
using System;
using System.Collections.Generic;
using System.Reflection;
namespace GenericFSM {
public class FSM<T> where T : struct, IConvertible {
public T State { get; private set; }
@NickCraver
NickCraver / Readme.md
Created April 10, 2016 19:40
A simple LINQPad script I wrote for load testing SQL Server.

This is a simple LINQPad script I wrote one day to load test some large SQL servers. Maybe it's useful to someone. The basic premise is defining your queries once, including which ID patterns to fetch (at the bottom), and load test a mixture. The script defines everything needed in one place, then fires up the command-line linqpad runner to run many queries at once.

Params up top:

const string LinqPadPath = @"C:\Linqpad\lprun.exe";
const bool runSequential = false;
const int defaultThreads = 1;
const int defaultIterations = 2000;
@joepie91
joepie91 / getting-started.md
Last active February 21, 2024 14:45
Getting started with Node.js

"How do I get started with Node?" is a commonly heard question in #Node.js. This gist is an attempt to compile some of the answers to that question. It's a perpetual work-in-progress.

And if this list didn't quite answer your questions, I'm available for tutoring and code review! A donation is also welcome :)

Setting expectations

Before you get started learning about JavaScript and Node.js, there's one very important article you need to read: Teach Yourself Programming in Ten Years.

Understand that it's going to take time to learn Node.js, just like it would take time to learn any other specialized topic - and that you're not going to learn effectively just by reading things, or following tutorials or courses. _Get out there and build things!

@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@yefim
yefim / app.coffee
Last active October 4, 2016 07:19
A simple opt in group messaging solution with Twilio, Redis, and Expressjs
NUMBERS_SET = 'numbers'
TWILIO_NUMBER = '+12345678900'
TWILIO_SID = 'account_sid'
TWILIO_TOKEN = 'auth_token'
express = require('express')
http = require('http')
path = require('path')
redis = require('redis')
app = express()