Skip to content

Instantly share code, notes, and snippets.

View scottoffen's full-sized avatar
💭
Live in SLC

Scott Offen scottoffen

💭
Live in SLC
View GitHub Profile
@scottoffen
scottoffen / clipboard-example.html
Last active April 13, 2022 08:38
JavaScript Copy To Clipboard Example
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Copy To Clipboard Example</title>
</head>
<body>
<input id="txtToCopy" type="text">
<button id="btnCopy">Copy!</button>
@scottoffen
scottoffen / autoloader.js
Last active December 9, 2015 01:01
Autoload Express Routes
var config = require('config/config');
var debug = require('debug')(global.app.name + ':autoloader');
var path = require('path');
var fs = require('fs');
var mask = /\.routes?\.js/i;
var _ = require('lodash');
/***********************************************************************************
* Autoloader entry point *
@scottoffen
scottoffen / add-datatables.js
Last active November 19, 2016 22:15
Apply the DataTables jQuery plugin to any table on a website
var options = { class : "wikitable", idx : 0, id : "firstWikiTable" };
var dt_options = { paging: false, scrollY: 400 };
var jscript = document.createElement("script"); jscript.src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"; document.body.appendChild(jscript);
jscript.onload = function ()
{
var script = document.createElement("script"); script.src="https://cdn.datatables.net/1.10.6/js/jquery.dataTables.min.js"; document.body.appendChild(script);
script.onload = function ()
{
var css = document.createElement("link"); css.rel="stylesheet"; css.href="https://cdn.datatables.net/1.10.6/css/jquery.dataTables.min.css"; document.body.appendChild(css);
css.onload = function ()
@scottoffen
scottoffen / neo4j.md
Last active August 29, 2015 14:26
Neo4j Resource

Utilities

  • Structr : Not yet sure what exactly this does.

node/npm

  • Seraph (npm) : A terse & familiar binding to the Neo4j REST API that is idiomatic to node.js
  • Seraph-Model (npm) : provides some convenient functions for storing and retrieving typed nodes from a neo4j database using seraph
  • Seraph-Resource : creates a controller with crud methods for a seraph model.
@scottoffen
scottoffen / node-file-uploads.md
Created July 23, 2015 19:52
Node.js File Uploads

On the frontend, use dropzone.js, on the backend, use connect-express.

Node Route Example

module.exports.post = function (req, res, next)
{
	console.log('request:');

	var fstream;
	req.pipe(req.busboy);
@scottoffen
scottoffen / mongodb-service.bat
Last active March 4, 2016 08:12
MongoDB Windows Service Setup
@echo off
if %1.==. goto UseDefaults
set srvname=%1
if %2.==. goto UseDefaultApp
set app=%2
if %3.==. goto UseDefaultConfig
set config=%3

My pi runs a raspbian distro (2013-09-25-wheezy-raspbian.zip)

Java

What the raspberry page officially recommends is the jdk. (Source: http://www.raspberrypi.org/archives/4920).

sudo apt-get update && sudo apt-get install oracle-java7-jdk

However, this doesn't include a server on the pi. The jre needs to be installed instead.

@scottoffen
scottoffen / map-world.pl
Last active August 29, 2015 14:18
Use Perl to create an AutoHotKey (ahk) macro that will run and build out your Minecraft world map
#!c:\lang\perl\bin\perl.exe
use strict;
use warnings;
use Fcntl qw(:DEFAULT :flock);
# How high you want to be teleported
my $y = 200;
# The x offset for the center of the map
my $offx = 1000;
@scottoffen
scottoffen / Example-User.pm
Created February 5, 2015 18:20
Example Perl module for a User table using Metaphor
package Example::User;
our $VERSION = '1.0.0';
#########################################||#########################################
# #
# Example::User #
# © Copyright Information and Link To Authors Site Goes Here #
# #
#########################################||#########################################