Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View edm00se's full-sized avatar

Eric McCormick edm00se

View GitHub Profile
@edm00se
edm00se / About.md
Last active May 31, 2017 03:11
An open letter to CBS & Paramount, regarding the release of their fan film guidelines.

An Open Letter to CBS & Paramount

CBS & Paramount recently released and announced the new guidelines for fan films (productions). That they are fairly limited in scope for those who seek to create as part of their passion is pretty obvious. I seek anyone who is so empassioned to provide the well reasoned and respectful feedback that Star Trek deserves.

In Short

To reach for the stars, we need to reach a little higher.

@edm00se
edm00se / ReadMe.md
Last active February 7, 2016 18:26
Sample utility library

Utility Library Example

Adding a utility library is a great and convenient way to provide convenince functions for use at a global or near-global level.

Adding

Hooking a utility SSJS library works about the same as any Code > Script Library asset in XPages. You can add it via a Theme, my personal recommendation as it makes keeping things tidy quite easy, or by adding it as an xp:resource (resources at the root XPage or Custom Control via the pretty pane). The down side of relying on adding it to a Custom Control is that it will only be available in an SSJS code block if the Custom Control in question has been loaded as part of the user's component tree (the built page); this also leads to potential duplication if the developer starts loading it on lots of Custom Controls.

Via Theme

@edm00se
edm00se / vanillaXhrGet.js
Last active June 15, 2017 19:43
Vanilla JS function to perform a GET XMLHttpRequest against a passed URL and execute the callback function with the returned results. On error, puts an error message to the console and returns null to the callback.
/*
* Note: these days you should probably just use fetch:
* https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
*
* A convenience function, to handle the vanilla js xhr
* request.
*
* @param {string} url - the URI against which to make the request
* @param callback - the callback function, which returns an obj,
* with two params, err (which is null of not error), and
@edm00se
edm00se / Error.xsp.xml
Last active September 24, 2015 14:12
Custom runtime error XPage with Google Code Prettify.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xsp/core xsdxp://localhost/xsp~core.xsd"
pageTitle="${javascript:database.getTitle() + ' | Error'}">
<style
type="text/css"><![CDATA[
body {
background-color: lightblue;
@edm00se
edm00se / ReadMe.md
Last active April 3, 2022 00:53
Sample nginx.conf settings to perform reverse proxy functionality to.

Read Me

In order to access a server hosted within a vm (guest), for development purposes from the host OS, which is restricted to same origin / localhost only requests, I set up a siple nginx reverse proxy to forward my requests.

Steps

  1. To install in a Windows VM, download and install nginx from the current, stable release; I installed to C:\nginx\
  2. Edit the <install path>/conf/nginx.conf file with the marked changes in the file of the same name in this gist.
  3. Start the nginx executable, located in your install path. There are service wrappers for Windows, or you can just kill the process to stop the nginx instance.

Commands for Windows

@edm00se
edm00se / bs-col-height-fixer.css
Created March 16, 2015 14:20
Responsive Bootstrap 3 column divs of equal height (for the row).
/*
* Provides Bootstrap 3 compatible classes for making responsive rows and columns consistently formatted for height.
* src: http://www.minimit.com/articles/solutions-tutorials/bootstrap-3-responsive-columns-of-same-height
*/
/* columns of same height styles */
.row-same-height {
display: table;
width: 100%;
}
/**
* An AngularJS directive for Dropzone.js, http://www.dropzonejs.com/
*
* Usage:
*
* <div ng-app="app" ng-controller="SomeCtrl">
* <button dropzone="dropzoneConfig">
* Drag and drop files here or click to upload
* </button>
* </div>
@edm00se
edm00se / com.hello.factory.ServletFactory.java
Created February 13, 2015 03:42
Sample ServletFactory for use in Domino/XPages.
package com.hello.factory;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import com.ibm.designer.runtime.domino.adapter.ComponentModule;
@edm00se
edm00se / com.hello.servlets.ExampleAbstractedServlet.java
Last active July 21, 2023 21:32
Ultra simple examples of HttpServlet, DesignerFacesServlet, and AbstractXSPServlet.
package com.hello.servlets;
import java.util.Enumeration;
import javax.faces.context.FacesContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ibm.commons.util.StringUtil;
@edm00se
edm00se / SampleComparatorUse.java
Last active August 29, 2015 14:11
Sample use of custom comparator in sorting a List<javax.faces.model.SelectItem> by the label, ascending. This is implemented inside a managed bean, fully registered in faces-config, with binding via EL in a sample XPage.
package com.eric.test;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import javax.faces.model.SelectItem;
public class SampleComparatorUse implements Serializable {