Skip to content

Instantly share code, notes, and snippets.

import {
AceComponent,
ButtonElementComponent,
VaadinTextField,
VaadinGrid,
Layout
} from 'ace-framework';
import DonerService from '../../services/doner.service';
@MoreOutput
MoreOutput / play.js
Last active August 31, 2017 02:40
Always bet on human
// Always bet on human
const p1 = {
human: false
};
switch (guess) {
case 'human':
if (p1.human === true) {
// whew, the human lives
@MoreOutput
MoreOutput / couch_gun.erl
Last active March 21, 2016 22:49
test asynchronous couchdb driver using gun with example cowboy rest handler
-module(couch_gun).
-export([connect/2, all_documents/2, get_document/3]).
%% Return an id for a couchdb connection
connect(_User, _Password) ->
gun:open("127.0.0.1", 5984),
receive
{gun_up, Pid, Protocol} ->
{Pid, Protocol};
{gun_down, _Protocol, Reason, _} ->
@MoreOutput
MoreOutput / gist:3516b00c5914f1cc06a4
Last active February 17, 2016 06:50
Use CLI to search the piratebay -- first pass just looked at music. unfinished obviously, not sure if the urls are up to date. checked root before pasting to gist.
'use strict';
var https = require('https'),
fs = require('fs'),
cheerio = require('cheerio'),
page = 0,
sortOption = 3,
$ = null,
minCnt = 40,
depth = 40,
results = [],
@MoreOutput
MoreOutput / userHelper.ssjs
Last active March 21, 2016 23:10
XPage SSJS User helper
/*
* Helper object for working with users within xpages
* Rocky Bevins 2009 (moreoutput@gmail.com)
*/
var User = function() {
}
User.prototype.create = function(fn) {
var userDoc = database.createDocument();
@MoreOutput
MoreOutput / gist:8079d42c54b9ad2fc04b
Last active August 29, 2015 14:19
Cowboy Module Testing
-module(page_handler).
-behaviour(cowboy_http_handler).
-export([init/3, handle/2, terminate/3]).
-record(state, {
}).
init(_, Req, _Opts) ->
{ok, Req, #state{}}.
@MoreOutput
MoreOutput / gist:d7631254ae0d6992c5c2
Created October 9, 2014 14:19
CakePHP model action for re-sizing an image -- you may want to make it a formal helper. Was written years ago YMMV.
public function createImage($file, $userID, $jobID, $entryID) {
if($file) {
echo var_dump($file);
if ((($file['type'] == 'image/jpeg') || ($file['type'] == 'image/png')) && ($file['size'] < 205000)) {
$thbPath = '/data/htdocs/indieop.com/public_html/app/webroot/img/entries/'.
$userID . '_' . $jobID . '_' . $entryID . '.' . pathinfo($file['name'], PATHINFO_EXTENSION);
$fPath = '/data/htdocs/indieop.com/public_html/app/webroot/img/entries/'.
$userID . '_' . $jobID . '_' . $entryID .'_max' . '.' . pathinfo($file['name'], PATHINFO_EXTENSION);
@MoreOutput
MoreOutput / vwToJson.js
Created June 26, 2013 03:31
Playing around with nodes process -- a not very robust CLI script that will export CouchDB view as a static JSON file
/**
* View-to-JSON CLI script for Node, turns a CouchDB view into a static JSON file.
* Version 0.0.1
* Example Useage: node vwtojson.js username password view filename directory server port
*/
var fs = require('fs'),
cradle = require('cradle'),
cradleConnection,
database,
username = process.argv[2],