Skip to content

Instantly share code, notes, and snippets.

Jake Bathman jakebathman

Block or report user

Report or block jakebathman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sha1sum
sha1sum / groupme_random_fact.php
Created Dec 15, 2014
Random Fact Generator for a GroupMe Bot (via callback URL)
View groupme_random_fact.php
<?php
/*
* Output a random fact to GroupMe via a bot.
*
* Trigger the bot with "!randomfact" or "!random fact".
* Enter the bot ID on line 43.
*
*/
View ordinal.php
function ordinal($number) {
$ends = array('th','st','nd','rd','th','th','th','th','th','th');
$mod100 = $number % 100;
return $number . ($mod100 >= 11 && $mod100 <= 13 ? 'th' : $ends[$number % 10]);
}
@carlosefonseca
carlosefonseca / json2gfmtable.py
Last active Jun 24, 2016
Creates a GitHub Flavored Markdown table from a JSON array passed to the stdin. Accepts a list of column names as the argument for column ordering and filtering.
View json2gfmtable.py
#!/usr/bin/env python3
# coding=utf-8
import json
import sys
# only reads from stdin
j = json.loads(sys.stdin.read())
# reads a list of column names from the argument "col1,col2" etc
@bmcculley
bmcculley / markov.php
Last active Apr 27, 2017
PHP Markov Chain class
View markov.php
<?php
/*
Levi Thornton from boogybonbon and wordze generously posted his php Markov
Chain class.. unfortunately there is a missing $nn++ thus the class can hang,
the working version is below all credit to Levi for the code, i just fixed a
bug.
Example Usage:
------------------
@maxogden
maxogden / readme.md
Created Aug 22, 2012
things I wish github notified me about
View readme.md

the new github notifications (https://github.com/blog/1204-notifications-stars) leaves me wanting more!

  • when someone comments on a gist that I either own or have also commented on
  • when someone comments on a commit (in a project that I'm not part of) that I have commented on
  • when someone makes a commit to a fork of one of my repos

notifications settings should let you choose whether or not to receive emails for the above things. there should also be a web UI that shows you a list of all comments/messages for the above scenarios. at the moment https://github.com/notifications only shows you github issue names which is less useful than showing the actual message (the old notifications page showed actual messages)

@paulirish
paulirish / gist:292907
Created Feb 2, 2010
ascii art that's perfect for code comments
View gist:292907
/* __
/ _)
.-^^^-/ /
__/ /
<__.|_|-|_|
*/
/*_/|
=0-0=
@Decicus
Decicus / setmulti_with_kadgar.md
Last active Jul 12, 2018
Miscellaneous Nightbot commands using variables
View setmulti_with_kadgar.md

Usage

!setmulti <streams> where <streams> is just the channel names for the ones you're streaming with, separated by a space between every channel.

Command

!commands add -a=!commands !setmulti edit !multi http://kadgar.net/live/$(channel)/$(eval const streams = '$(query)'.split(" ");streams.join("/");)

@sbine
sbine / .phpcs.xml
Last active Mar 6, 2019 — forked from loganhenson/.phpcs.xml
.phpcs.xml in your home directory (`cd ~`)
View .phpcs.xml
<?xml version="1.0"?>
<ruleset name="Laravel Standards">
<!--
The name attribute of the ruleset tag is displayed
when running PHP_CodeSniffer with the -v command line
argument. The description tag below is not displayed anywhere
except in this file, so it can contain information for
developers who may change this file in the future.
-->
<description>The Laravel Coding Standards</description>
@jeromer
jeromer / orthodromicdistance.py
Created Feb 22, 2012
Orthodromic distance using the Harversine formula in Python
View orthodromicdistance.py
# -*- coding: utf-8 -*-
import math
def calculate_orthodromic_distance(pointA, pointB):
"""
Calculates the great circle distance between two points.
The great circle distance is the shortest distance.
This function uses the Haversine formula :
- https://en.wikipedia.org/wiki/Haversine_formula
@IanSimpson
IanSimpson / imb.php
Created May 28, 2015
PHP IMB Barcode Converter
View imb.php
<?
/**
* IMB Converter
* =============
* This class takes a numeric code (in the valid format) and returns a string in ATDF format, ready to be printed
* with the USPS IMB font
*
* Code extracted from TCPDF and modified to operate standalone. See http://www.tcpdf.org
*
* Usage:
You can’t perform that action at this time.