Skip to content

Instantly share code, notes, and snippets.

View zbee's full-sized avatar
👾

Ethan Henderson zbee

👾
View GitHub Profile
@zbee
zbee / Minecraft-API Example Fixes
Last active August 29, 2015 13:56
The Minecraft-API examples are rather derpy and not really working. I present you working ones.
CURRENT (BROKEN - It cannot possibly return a number of players from the API method that returns only true or false based on whether the server is up. The status method doesn't even return data.players)
var ip = "player.server.com";
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://minecraft-api.com/v1/status/?server=" + ip, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
data = JSON.parse(xhr.responseText);
if (data.status) {
@zbee
zbee / _claps
Last active August 29, 2015 14:01
claps.js
At some point in my life I needed to use JQuery's toggle(), show(), and hide() functions but could not use JQuery, so I made claps.js.
I have no idea why anyone else would need this -heck, I can't remember why I needed it-, but here it is anyways.
Enjoy.
@zbee
zbee / bootswatchList-postJS.html
Last active August 29, 2015 14:02
Use the bootswatch API to shift through and list all of their themes (With thumbnail and name
<!DOCTYPE html>
<html>
<body>
<div id="select">
<div class="Cerulean"><img src="http://bootswatch.com/cerulean/thumbnail.png" width="250px"><br>Cerulean<hr></div>
<div class="Cosmo"><img src="http://bootswatch.com/cosmo/thumbnail.png" width="250px"><br>Cosmo<hr></div>
<div class="Cyborg"><img src="http://bootswatch.com/cyborg/thumbnail.png" width="250px"><br>Cyborg<hr></div>
<div class="Darkly"><img src="http://bootswatch.com/darkly/thumbnail.png" width="250px"><br>Darkly<hr></div>
<div class="Flatly"><img src="http://bootswatch.com/flatly/thumbnail.png" width="250px"><br>Flatly<hr></div>
@zbee
zbee / unJQSerialize
Last active August 29, 2015 14:03
Format jQuery's serialize() in PHP as actual array
Ok, so when you serialize a form in JQuery - $('#my-form').serialize() - you get something like
title=cake&date=2014-07-10 2:56PM&content=cake cake cake&tags=cake&new=post
Obviously, that isn't super useful to PHP and unserialize() does nothing for it.
So, I made unJQSerialize(); which is a little function to go through the serialized form and break it down into an actual PHP array.
When unJQSerialize() is used, you'll get something like
[title] => cake [date] => 2014-07-10 2:56PM [content] => cake cake cake [tags] => cake [new] => post
@zbee
zbee / _wowCur.md
Last active August 29, 2015 14:04
World of Warcraft simple currency formatter

#WoW Currency Formatter When using the battle.net API amounts of currency (like how much money you have, or how much a buyout for an auction item is) are displayed as a simple amount of copper (example: 174056); And that's not human readable.

So, I made a little baby function to format into either g s c or the padded version (adds a 0 in front of silver and copper if it's a single digit).

Hope someone needs this eventually :)


##Examples:

@zbee
zbee / fileNav.php
Last active August 29, 2015 14:11
A simple little file to be set at the root of a directory with many images and subdirectories when enables easy viewing of images and navigation of directories.
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<Br>
<?php
function check($array, $input) {
foreach($array as $value) {
if(strpos($input, $value) !== false) {
return true;
return false;
}
@zbee
zbee / theFacebookPost.md
Last active August 29, 2015 14:12
Response to stupid people on Facebook who think law is fun.

You know these awful posts on Facebook?

Well I was still up at 4am and saw one on Facebook and I had nothing better to do, so I figured I'd start looking at the stupid crap it claims to be helpful.

@zbee
zbee / sexyTime.js
Last active August 29, 2015 14:13
sexyTime is a small jQuery plugin for short countdown timers.
(function ($) {
$.fn.sexyTime = function (options) {
var opts = $.extend({}, $.fn.sexyTime.defaults, options);
var time = opts.time;
return this.each(function() {
var position = $(this).position();
$(this).css("z-index", "100");
$(this).css("position", "relative");
$(this).css("text-align", "center");
@zbee
zbee / ubuntu-ruby.sh
Last active August 29, 2015 14:13 — forked from stephanetimmermans/ubuntu-compass-ruby
Install ruby on Ubuntu
#https://gorails.com/setup/ubuntu/14.04
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
#if GPG signature verification fails, do `$ curl -sSL https://rvm.io/mpapis.asc | gpg --import -`
#then retry the previous command
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
@zbee
zbee / infoAboutPhoneThroughoutDay.js
Last active August 29, 2015 14:14
My on{x} scripts
//This logs a lot of information about your device throughout the day.
//I used it to help my parents understand why their phones died faster some days.
function reportData () {
var data = {};
data.battery = "At " + device.battery.status.percentage + "% (" + device.battery.status.powerSource + ")";
if (device.bluetooth.enabled === true) {
data.bluetooth = "On; Paired with " + device.bluetooth.pairedDevices.length + " devices";
} else {
data.bluetooth = "Off";