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
@jakebathman
jakebathman / jsonToCsv.php
Last active Jun 21, 2019 — forked from Kostanos/json-to-csv.php
A function to convert a JSON string (or a PHP array) to a CSV file or CSV string echoed to the browser
View jsonToCsv.php
<?php
/*
*
* Based on (forked from) the work by https://gist.github.com/Kostanos
*
* This revision allows the PHP file to be included/required in another PHP file and called as a function, rather than focusing on command line usage.
*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
@jakebathman
jakebathman / Auto-clicker for TheButton.md
Last active Aug 29, 2015
Auto-clicker for /r/TheButton
View Auto-clicker for TheButton.md

###AUTO BUTTON CLICKER

This little script will automatically click The Button (http://www.reddit.com/r/thebutton) when the timer goes below a certain time (set by the user as intClickUnderTime).

This will only run until you refresh the page or navigate away.

⚠️ ⚠️ ⚠️

REVIEW THIS CODE CAREFULLY.

@jakebathman
jakebathman / geoDistance.php
Last active Feb 15, 2016
Lat/Lon Distance Calculator
View geoDistance.php
<?php
/**
* Calculate the distance between two points on a sphere
*
* Implements the Haversine formula: http://en.wikipedia.org/wiki/Haversine_formula
*
* More advanced calculation (good for antipodal points) can be used by using
* FALSE for $boolUseHaversine. This will use another solution to the Great-circle
* ditance problem (http://en.wikipedia.org/wiki/Great-circle_distance), implementing
* the Vincenty formula (http://en.wikipedia.org/wiki/Vincenty%27s_formulae#Nearly_antipodal_points).
@jakebathman
jakebathman / map.php
Last active Aug 29, 2015
Google Maps v3 basic example
View map.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
@jakebathman
jakebathman / markov.php
Last active Aug 29, 2015 — forked from bmcculley/markov.php
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:
------------------
View BASE64SHA1.vbs
Public Function BASE64SHA1(ByVal sTextToHash As String)
Dim asc As Object
Dim enc As Object
Dim TextToHash() As Byte
Dim SharedSecretKey() As Byte
Dim bytes() As Byte
Const cutoff As Integer = 5
Set asc = CreateObject("System.Text.UTF8Encoding")
View StringConcat.vbs
Function StringConcat(Sep As String, ParamArray Args()) As Variant
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' StringConcat
' By Chip Pearson, chip@cpearson.com, www.cpearson.com
' www.cpearson.com/Excel/stringconcatenation.aspx
' This function concatenates all the elements in the Args array,
' delimited by the Sep character, into a single string. This function
' can be used in an array formula. There is a VBA imposed limit that
' a string in a passed in array (e.g., calling this function from
' an array formula in a worksheet cell) must be less than 256 characters.
@jakebathman
jakebathman / botPost.php
Last active Sep 8, 2018
GroupMe bot post function including @mentions
View botPost.php
<?php
/**
* Post a message from a bot to a group
*
* $groupId (string) GroupId of the group to post the message
* $strMessage (string) Text of the message to post (limit of 1000 characters)
* $strBotId (string) ID of the bot which will post the message
* $mentionUsers (array) [optional] array of userIds to mention (uses attachment)
* Example array of userIds:
@jakebathman
jakebathman / groupMeApi.php
Last active Aug 28, 2015
GroupMe API post
View groupMeApi.php
public function apiPost($url, $data = array() , $boolHeaders = false)
{
$ch = curl_init($url);
if (empty($data['file']))
{
$data = json_encode($data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data)
));
View regex.php
<?php
$arrRegexPatterns = array(
'subreddit' => "/(reddit\.com|reddittryhard\.com)?(?:\/r\/){1}([\w]+)/i",
);
if (preg_match($arrRegexPatterns['subreddit'], $text, $arrMatches) !== false)
{
echo json_encode($arrMatches);
}
You can’t perform that action at this time.