View controllers.application.js
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
View gist:ae311d7fdaf8866a1a47b9bfe8532c5a
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 { |
View react-konva.js
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]) |
View thing.js
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 |
View JS template tag regexp
function template(str, data) { | |
return str.replace(/\{(.*?)\}/g, function (derp, tag) { return data[tag]; }); | |
} |
View Thingyforvids
// ==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== |
View 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"; |
View check.js
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); |
View offlineStorage.js
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() { |
View random.php
<?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 = './'; |
NewerOlder