Skip to content

Instantly share code, notes, and snippets.

View tetri's full-sized avatar
🎯
Focusing

Tetri Mesquita tetri

🎯
Focusing
View GitHub Profile
@evantoli
evantoli / GitConfigHttpProxy.md
Last active June 19, 2024 00:17
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@DanDiplo
DanDiplo / JS-LINQ.js
Last active June 25, 2024 23:39
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
@waynegraham
waynegraham / authors.txt
Last active February 9, 2024 18:18
Get authors from svn repository
wsg4w = Wayne Graham <wsg4w@uva.edu>
@trevordixon
trevordixon / simplex.cs
Last active February 10, 2024 22:54
Simplex maximization algorithm in C#
using System;
using System.Diagnostics;
using System.Collections.Generic;
namespace Simplex {
class Simplex {
private double[] c;
private double[,] A;
private double[] b;
private HashSet<int> N = new HashSet<int>();
@padolsey
padolsey / friday.js
Created August 16, 2013 09:26
Utilities for Friday
function isItFriday() {
return new Date().getDay() === 5 ?
'It is!' :
'It is not.';
}
function whenWillItBeFriday() {
var d = 5 - new Date().getDay();
return d === 0 ?
'Right now!' :
@clupasq
clupasq / timeout.cs
Created September 4, 2012 12:34
C# Timeout implementation
[Test]
public void ComputeResultWithTimeout()
{
var task = Task.Factory.StartNew(() => ComputeResult("bla"));
//task.Wait(0999);
task.Wait(1000);
if (task.IsCompleted)
Console.WriteLine("OK, got: " + task.Result);
@tbranyen
tbranyen / string.format.js
Created June 27, 2011 18:22
safer string formatting
// Inspired by http://bit.ly/juSAWl
// Augment String.prototype to allow for easier formatting. This implementation
// doesn't completely destroy any existing String.prototype.format functions,
// and will stringify objects/arrays.
String.prototype.format = function(i, safe, arg) {
function format() {
var str = this, len = arguments.length+1;
// For each {0} {1} {n...} replace with the argument in that position. If