Skip to content

Instantly share code, notes, and snippets.

View gilbert's full-sized avatar
🪐
Security in space

Gilbert gilbert

🪐
Security in space
View GitHub Profile
@beastaugh
beastaugh / CountLicenses.hs
Created April 26, 2011 20:31
Script to count how many different packages use particular licenses on Hackage.
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
{-
To use this script you need to extract your local Hackage index file. If
your setup is anything like mine, you should be able to find a .tar file
containing the listing somewhere like this:
~/.cabal/packages/hackage.haskell.org/00-index.tar.gz
@cmalven
cmalven / index.html
Last active April 27, 2024 10:17
Shortest (useful) HTML5 Document
<!-- http://www.brucelawson.co.uk/2010/a-minimal-html5-document/ -->
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>blah</title>
</head>
<body>
<p>I'm the content</p>
@austenito
austenito / integration_spec.rb
Created April 11, 2012 12:50
Integration Testing w/ Sorcery
describe "Shopping Cart Requests" do
let!(:user) { Fabricate(:user) }
before(:each) do
login_user_post("admin", "admin")
end
context "when I visit the shopping cart" do
it " show the logged in users' cart items " do
#Test stuff
@shaunxcode
shaunxcode / underscoreR.coffee
Created May 7, 2012 00:06 — forked from jimtla/underscoreR.coffee
Add CoffeeScript friendly kv args to Underscore.js
#names of functions to create KV versions of and arg lists (in order)
to_kv = throttle: ['func', 'wait'], delay: ['func', 'wait'], defer: ['func'], bind: ['func', 'context']
mixin = {}
for name, arglist of to_kv
do (name, arglist) ->
mixin["#{name}KV"] = (kvargs) ->
args = (kvargs[arg] for arg in arglist when kvargs[arg]?)
if arglist.length isnt args.length then throw new Error "missing args"
_[name](args...)
@JosephLenton
JosephLenton / spider.pl
Created July 28, 2012 03:49
prolog text adventure game
/* SPIDER -- a sample adventure game, by David Matuszek.
Consult this file and issue the command: start. */
:- dynamic at/2, i_am_at/1, alive/1. /* Needed by SWI-Prolog. */
:- retractall(at(_, _)), retractall(i_am_at(_)), retractall(alive(_)).
/* This defines my current location. */
i_am_at(meadow).
@datagrok
datagrok / git-serve.md
Last active April 21, 2023 07:33
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.
@sukima
sukima / XORCipher.js
Last active May 9, 2024 23:49
A Super simple encryption cipher using XOR and Base64 in JavaScript
// XORCipher - Super simple encryption using XOR and Base64
//
// Depends on [Underscore](http://underscorejs.org/).
//
// As a warning, this is **not** a secure encryption algorythm. It uses a very
// simplistic keystore and will be easy to crack.
//
// The Base64 algorythm is a modification of the one used in phpjs.org
// * http://phpjs.org/functions/base64_encode/
// * http://phpjs.org/functions/base64_decode/
@robschmuecker
robschmuecker / README.md
Last active May 13, 2024 20:57
D3.js Drag and Drop, Zoomable, Panning, Collapsible Tree with auto-sizing.

This example pulls together various examples of work with trees in D3.js.

The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.

One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.

Dragging can be performed on any node other than root (flare). Dropping can be done on any node.

Panning can either be done by dragging an empty part of the SVG around or dragging a node towards an edge.

@jfromaniello
jfromaniello / gist:8418116
Last active September 19, 2023 23:38
Example of authenticating websockets with JWTs.
var WebSocketServer = require('ws').Server;
var wss = new WebSocketServer({port: 8080});
var jwt = require('jsonwebtoken');
/**
The way I like to work with 'ws' is to convert everything to an event if possible.
**/
function toEvent (message) {
try {
@staltz
staltz / introrx.md
Last active May 30, 2024 18:43
The introduction to Reactive Programming you've been missing