Skip to content

Instantly share code, notes, and snippets.

View FirstWhack's full-sized avatar

Josiah FirstWhack

View GitHub Profile
<?php
$folder = 'mfimages/';
// Space seperated list of extensions, you probably won't have to change this.
$exts = 'jpg jpeg png gif';
$files = array(); $i = -1; // Initialize some variables
if ('' == $folder) $folder = './';
function responseSuccess(data) {
localStorage.setItem('_echo_' + $.mobile.activePage.attr('id'), JSON.stringify(data));
console.info('Stored '+ $.mobile.activePage.attr('id')+ ' response');
}
// Check connection
function checkConnection() {
function runCheck(host, cb) {
console.log('Checking for life at ' + host + ' we checked '+ checks + ' times so far');
var checkReq = http.get(host, function(res) {
console.log("Got response: " + res.statusCode);
ret = 'online';
checkReq.clearTimeout();
console.log('Timeout cleared and sending them on their way');
cb(true); // we are solid
}).on('error', function(e) {
console.log('error' + e);
@FirstWhack
FirstWhack / autobin.js
Last active August 29, 2015 14:13 — forked from rlemon/autobin.js
// ==UserScript==
// @name SO Chat room gif autobinner
// @author Robert Lemon
// @version 0.0.31
// @namespace
// @description make rooms not suffer gifs
// @include http://chat.stackoverflow.com/rooms/*
// ==/UserScript==
(function(global) {
"use strict";
// ==UserScript==
// @name Stackexchange HTML 5 Youtube Enabler
// @namespace http://your.homepage/
// @version 0.1
// @description Replaces embed tags with iFrames and uses the Youtube Iframe API
// @author jhawins
// @include http://*stackexchange.com/questions/*
// @include http://*stackoverflow.com/questions/*
// @grant none
// ==/UserScript==
function template(str, data) {
return str.replace(/\{(.*?)\}/g, function (derp, tag) { return data[tag]; });
}
var React = require('react'),
{ ButtonGroup, Button } = require('react-bootstrap'),
ResultPaging = React.createClass({
displayName: 'ResultPaging',
propTypes: {
page: React.PropTypes.number,
pageSize: React.PropTypes.number,
totalCount: React.PropTypes.number,
changePage: React.PropTypes.func
var ReactKonva =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
getDownload(url, body, params) {
this.query(url, body, params, 'GET').then(resp => {
resp.blob().then(blob => this.blobDownload(blob, resp));
});
}
blobDownload(blob, resp) {
const fileName = (resp.headers.get('Content-Disposition') || '').match(/filename="?(.+[^"])"?/)[1]; // matches `filename="a.b"` or `filename=a.b` as 'a.b'
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(blob, fileName);
} else {
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});