Skip to content

Instantly share code, notes, and snippets.

@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@mtigas
mtigas / gist:952344
Last active June 20, 2024 11:22
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@aliostad
aliostad / PollingWorker.cs
Created June 26, 2012 15:40
A class that creates a dedicated thread to poll
using System.Collections.Generic;
namespace System.Threading
{
public class PollingWorker : IPollingWorker,IDisposable
{
private class TickAction
{
public string Name { get; set; }
public Action Work { get; set; }
@johnnyreilly
johnnyreilly / ScriptExtensions.cs
Created June 29, 2012 16:51
HTML Helper for creating / rendering scripts when working in ASP.NET MVC (heavily based on Michael Ryans original work; see links enclosed)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
using System.Text;
namespace DummyMvc.Helpers
{
@khalidabuhakmeh
khalidabuhakmeh / RavenDB.cs
Created November 6, 2012 15:15
RavenDB If extension method
// usage
_db.Query<Story, Stories_Search>()
.If(status.HasValue, q => q.Where(x => x.Status == status))
.If(!curatorId.IsEmpty(), q => q.Where(x => x.CuratorId == curatorId))
.If(publicationDate.HasValue, q => q.Where(x => x.ProposedPublicationDate == publicationDate.Value.Date))
.OrderByDescending(x => x.CreatedAt)
.ToPagedList(page, size);
@npryce
npryce / property-based-testing-tools.md
Last active July 29, 2024 08:38
Property-Based Testing Tools

If you're coming to the Property-Based TDD As If You Meant It Workshop, you will need to bring a laptop with your favourite programming environment, a property-based testing library and, depending on the language, a test framework to run the property-based-tests.

Any other languages or suggestions? Comment below.

.NET (C#, F#, VB)

Python:

@hydr
hydr / gist:4338698
Created December 19, 2012 17:47
ToGoogleMapsPolygon
public static List<List<Coordinate>> ToGoogleMapsPolygon(this DbGeography dbGeo)
{
// contains all geo data for one postal code / admin area code
// conversion to SqlGeography because DbGeography does not offer properties to determine rings within geometries. we need those ring information to display areas with holes
var sqlGeo = (SqlGeography) dbGeo.ProviderValue;
var numberOfGeometries = sqlGeo.STNumGeometries();
var result = new List<List<Coordinate>>((int) numberOfGeometries);
@thecodejunkie
thecodejunkie / gist:4564425
Created January 18, 2013 13:01
modal binding for knockoutjs that utilizes fancybox internally
ko.bindingHandlers.modal = {
update: function (element, valueAccessor) {
$(element).click(function () {
$.fancybox({ content: $('<div/>').addClass('list-widget').html($('.content', $(element).parent()).html()) });
});
}
};

Build your own private, encrypted, open-source Dropbox-esque sync folder

Prerequisites:

  • One or more clients running a UNIX-like OS. Examples are given for Ubuntu 12.04 LTS, although all software components are available for other platforms as well (e.g. OS X). YMMV
  • A cheap Ubuntu 12.04 VPS with storage. I recommend Backupsy, they offer 250GB storage for $5/month. Ask Google for coupon codes.

Software components used:

  • Unison for file synchronization
  • EncFS for folder encryption
@jbenet
jbenet / simple-git-branching-model.md
Last active June 17, 2024 14:53
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.