Skip to content

Instantly share code, notes, and snippets.

@erikzaadi
erikzaadi / MD5AsExtension.cs
Created December 9, 2010 08:01
A one liner method for MD5 Hashing / performance / verbose approach?
public static string ToMD5(this string input)
{
//comment about this
var sb = new System.Text.StringBuilder();
//comment about that
var md5 = System.Security.Cryptography.MD5.Create();
var bytesFromInput = System.Text.Encoding.Unicode.GetBytes(input);
var hashedBytes = md5.ComputeHash(bytesFromInput);
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using FluentAssertions;
using NUnit.Framework;
using Nancy.Helpers;
namespace NancySelfHosting
@scttnlsn
scttnlsn / base_view.js
Created May 8, 2012 17:00
Backbone.js base view
var BaseView = Backbone.View.extend({
close: function() {
this.closeSubviews();
this.unbindFromAll();
this.off();
this.remove();
if (this.onClose) this.onClose();
},
@baldowl
baldowl / import.rb
Created January 8, 2012 16:41 — forked from juniorz/import.rb
Import a blogger archive to jekyll (octopress version)
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
@cangoektas
cangoektas / comparison.md
Last active November 10, 2018 01:21
Core rule settings of popular ESLint configs

Core rule settings of popular ESLint configs

An overview of how popular ESLint configs use the latest core rules. The rules are listed in the order they appear on the ESLint rules page: https://eslint.org/docs/rules/.

Configs

Name Weekly NPM Downloads
eslint:recommended (installed with ESLint)
airbnb         699,637          
@jdx
jdx / boot.js
Last active March 16, 2023 18:08
zero-downtime node.js app runner
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
@sh1n0b1
sh1n0b1 / ssltest.py
Created April 8, 2014 07:53
Python Heartbleed (CVE-2014-0160) Proof of Concept
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@davatron5000
davatron5000 / gist:2254924
Created March 30, 2012 20:57
Static Site Generators

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2: