Skip to content

Instantly share code, notes, and snippets.

var oneDay = 86400;
module.exports = function (connect) {
var Store = connect.session.Store
, PGStore;
PGStore = function (options) {
var self = this;
@gabrfarina
gabrfarina / fizz_buzz_generator.rs
Created October 26, 2017 20:33
FizzBuzzGenerator
#![feature(inclusive_range_syntax, generators, generator_trait, never_type)]
use std::ops::{Generator, GeneratorState};
fn is_div_by(n: u64, modulus: u64) -> bool {
if n % modulus == 0 {
true
} else {
false
}

Here's how you validate a mailgun webhook in Node.js (as per the mailgun docs for securing webhooks)

'use strict';

var scmp = require('scmp')
  , crypto = require('crypto')
  . mailgunPrivateKey = 'XXXXXXXXXXXXX'
  , mailgunTokens = {}
  , mailgunExpirey = 15 * 60 * 1000
@toastal
toastal / Main.elm
Created December 6, 2016 22:46
Elm URL Parsing Playaround
module Main exposing (..)
{-| elm-package install elm-lang/navigation evancz/url-parser
-}
import Html exposing (Html, caption, div, table, tbody, td, text, th, thead, tr)
import Navigation exposing (Location)
import String
import UrlParser exposing (Parser, (</>), map, oneOf, s, int, string, top, parseHash)
@milsosa
milsosa / test.js
Last active July 21, 2021 21:20
Run Mocha Tests
'use strict';
// 1. Create the file: {projectRoot}/test.js
// 2. Install dependencies: npm i glob why-is-node-running
// 3. Run the tests: node --expose-internals test.js
const whyIsNodeRunning = require('why-is-node-running');
const glob = require('glob');
const Mocha = require('mocha');
@yosemitebandit
yosemitebandit / key-fingerprint
Created March 7, 2012 18:27
view your ssh public key's fingerprint; compare this to what Github has listed in the ssh key audit
$ ssh-keygen -l -f /path/to/keys/id_rsa.pub
2048 aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99 id_rsa.pub (RSA)
@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong
@Qix-
Qix- / sha256.sh
Last active July 10, 2023 10:00
SHA256 in (mostly) pure Bash script
#!/usr/bin/env bash
# Released into the Public Domain.
#
# Original implementation in C by Brad Conte (brad@bradconte.com) <https://github.com/B-Con/crypto-algorithms>
# Ported to Bash (lol) by Josh Junon (josh@junon.me) <https://github.com/qix->
#
# Yes, it's absolutely as slow as it looks.
#
# The only external dependency it has is on a utility called `od`,
@jasongilman
jasongilman / atom_clojure_setup.md
Last active January 11, 2024 09:13
This describes how I setup Atom for Clojure Development.

Atom Clojure Setup

This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.

Install Atom

Download Atom

The Atom documentation is excellent. It's highly worth reading the flight manual.

@defunctzombie
defunctzombie / browser.md
Last active April 10, 2024 17:45
browser field spec for package.json