Skip to content

Instantly share code, notes, and snippets.

View index.js
'use strict'
const express = require('express')
const LEX = require('letsencrypt-express').testing()
const DOMAIN = 'localhost'
const EMAIL = 'devnull@danpantry.me'
const lex = LEX.create({
configDir: require('os').homedir() + '/letsencrypt/etc',
approveRegistration(hostname, approve) {
if (hostname === DOMAIN) {
anonymous
anonymous / GAME_MASTER_v0_1.protobuf
Created July 16, 2016 16:31
Pokemon Go decoded GAME_MASTER protobuf file v0.1
View GAME_MASTER_v0_1.protobuf
Result: 1
Items {
TemplateId: "BADGE_BATTLE_ATTACK_WON"
Badge {
BadgeType: BADGE_BATTLE_ATTACK_WON
BadgeRanks: 4
Targets: "\nd\350\007"
}
}
Items {
@vihanb
vihanb / chatgoat.js
Last active February 26, 2016 06:17
Chatgoat
View chatgoat.js
// The Chatbot run on
// @Upgoat (StackExchange)
// http://codegolf.stackexchange.com/users/47996
function Speak(out,m) {document.getElementById("input").value=(m?":"+m.id.split("-")[1]+" ":"")+out;document.getElementById("sayit-button").click()}
Array.prototype.random = function() { return this.length ? this[Math.floor(Math.random() * this.length)] : "<broken goat/no items>" };
//console.log = (function(old){return function(){Speak.apply(this, arguments);old.apply(console, arguments)}}(console.log));
function WolframQuery(search,callback){var x=new XMLHttpRequest();x.onreadystatechange=function(){if(x.readyState===4){if(x.status===200){callback(x.responseXML)}}};x.open("GET","https://crossorigin.me/http://api.wolframalpha.com/v2/query?input="+encodeURIComponent(search)+"&appid=<TOP_SECRET_APP_ID>");x.send();}
@elendiastarman
elendiastarman / PyAcidic Musings.md
Last active January 15, 2016 04:42
PyAcidic Musings
View PyAcidic Musings.md

#PyAcidic Musings

[toc]

##Succinctness is Power

I like the idea of "succinctness is power", as discussed in this blog post. For me, what I picked up on was that succinctness doesn't necessarily mean brevity, but rather, how much can you say with a simple word or phrase. For example, the quadratic formula

$$\frac{-b \pm \sqrt{b^2-4ac}}{2a}$$

@turbo
turbo / lol.c
Created November 9, 2015 23:30
Experiment
View lol.c
#include <unistd.h>/* minxomat */
#define omg ) {
#define lol ; write ( 1 , o , 1
#define ha char r[2], *o=r; main(
#define l ; -- *
#define hi ++ * o;
#define hah(a) ; while ( * a omg
#define lal l o l
#define lmao lal o lal o lal
#define ohmahgod ) ; exit ( 0);}
@gaearon
gaearon / slim-redux.js
Last active August 2, 2023 17:23
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
View slim-redux.js
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@bosconian-dynamics
bosconian-dynamics / Shortened URL RegEx
Last active July 10, 2018 21:46
Regular expression to match shortened/masked URLs generated from LongURL.org's api via the JavaScript functions at http://gist.github.com/KuroTsuto/8447974
View Shortened URL RegEx
/(?:https?:\/\/)?(?:(?:0rz\.tw)|(?:1link\.in)|(?:1url\.com)|(?:2\.gp)|(?:2big\.at)|(?:2tu\.us)|(?:3\.ly)|(?:307\.to)|(?:4ms\.me)|(?:4sq\.com)|(?:4url\.cc)|(?:6url\.com)|(?:7\.ly)|(?:a\.gg)|(?:a\.nf)|(?:aa\.cx)|(?:abcurl\.net)|(?:ad\.vu)|(?:adf\.ly)|(?:adjix\.com)|(?:afx\.cc)|(?:all\.fuseurl.com)|(?:alturl\.com)|(?:amzn\.to)|(?:ar\.gy)|(?:arst\.ch)|(?:atu\.ca)|(?:azc\.cc)|(?:b23\.ru)|(?:b2l\.me)|(?:bacn\.me)|(?:bcool\.bz)|(?:binged\.it)|(?:bit\.ly)|(?:bizj\.us)|(?:bloat\.me)|(?:bravo\.ly)|(?:bsa\.ly)|(?:budurl\.com)|(?:canurl\.com)|(?:chilp\.it)|(?:chzb\.gr)|(?:cl\.lk)|(?:cl\.ly)|(?:clck\.ru)|(?:cli\.gs)|(?:cliccami\.info)|(?:clickthru\.ca)|(?:clop\.in)|(?:conta\.cc)|(?:cort\.as)|(?:cot\.ag)|(?:crks\.me)|(?:ctvr\.us)|(?:cutt\.us)|(?:dai\.ly)|(?:decenturl\.com)|(?:dfl8\.me)|(?:digbig\.com)|(?:digg\.com)|(?:disq\.us)|(?:dld\.bz)|(?:dlvr\.it)|(?:do\.my)|(?:doiop\.com)|(?:dopen\.us)|(?:easyuri\.com)|(?:easyurl\.net)|(?:eepurl\.com)|(?:eweri\.com)|(?:fa\.by)|(?:fav\.me)|(?:fb\.me)|(?:fbshare\.me)|(?:ff\.im)|(?:fff\
@rtgibbons
rtgibbons / logger.js
Created November 7, 2013 13:51
Logger Library with winston
View logger.js
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',
@Zirak
Zirak / gist:3086939
Last active August 27, 2022 22:01
xhr for dummies
View gist:3086939

So, you want to send a motherfucking XMLHttpRequest (XHR, or commonly and falsly known as AJAX.) Too bad, just ran out of motherfucking XMLHttpRequests; but I still have one regular. XHR is not magic. It does not autofuckinmagically send things the way you want them do be sent. It does not do the thinking for you. It just sends an Http Request.

You get a hold on such a prime beast like this:

@josegonzalez
josegonzalez / category.rb
Created August 14, 2010 21:41
Category plugin for Jekyll
View category.rb
module Jekyll
class CategoryIndex < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')