Skip to content

Instantly share code, notes, and snippets.

View practicalli-johnny's full-sized avatar
😺
Software Engineering education and advocacy with a focus on Clojure

Practicalli Johnny practicalli-johnny

😺
Software Engineering education and advocacy with a focus on Clojure
View GitHub Profile
@practicalli-johnny
practicalli-johnny / octopress-gist-example
Last active August 29, 2015 13:57
Using the Gist directive in Octopress
## Gist Syntax for Octopress
{% gist gist_id [filename] %}
## Example Gist in Octopress
{% gist 9532424 %}
@practicalli-johnny
practicalli-johnny / profile-nodejs
Created May 26, 2014 17:11
adding nodejs to system path in Ubuntu bash .profile
# Add locally installed nodejs and node package manager to the PATH
# Check that the nodejs folder exists before adding
if [ -d "$HOME/apps/nodejs" ] ; then
NODEJS_HOME=$HOME/apps/nodejs/current
PATH="$NODEJS_HOME/bin:$PATH"
fi
@practicalli-johnny
practicalli-johnny / post.md
Created July 13, 2014 15:38
Hexo blog post template

title: {{ title }} date: {{ date }} categories: tags:

Thank you. @jr0cket

@practicalli-johnny
practicalli-johnny / app.json
Created August 11, 2014 13:43
Heroku Button manifest file for sample Node.js App
{
"name": "Node.js Sample",
"description": "A barebones Node.js app using Express 4",
"repository": "https://github.com/heroku/node-js-sample",
"logo": "https://node-js-sample.herokuapp.com/node.svg",
"keywords": ["node", "express", "static"]
}
@practicalli-johnny
practicalli-johnny / heroku-button.html
Created August 11, 2014 13:51
HTML for Heroku Button - Node.js App example
<a href="https://heroku.com/deploy?template=https://github.com/heroku/node-js-sample">
<img src="https://www.herokucdn.com/deploy/button.png" alt="Deploy my App to Heroku">
</a>
@practicalli-johnny
practicalli-johnny / UpdateDueDate.cls
Last active August 29, 2015 14:14
UpdateDueDate class alternate example
// Note: VerifyDate seems to be quite obscure as a class name, so have changed it to UpdateDueDate, as this is what I understand the intent of the class to be.
// If updating a due date is not the intent, then I did not understand the intent of the code.
public class UpdateDueDate {
// Examples:
// if current date is 15th Feb and due date is 22nd Feb, return 22nd
// if current date is 3rd Feb and due date is 5th March, return the last date in February
public static Date SetDueDateWithin30Days(Date currentDate, Date dueDate) {
@practicalli-johnny
practicalli-johnny / RestrictContactLastName
Last active August 29, 2015 14:14
Trigger to restrict contact by last name
trigger RestrictContactLastName on Contact (before insert, before update) {
// Prevent updating or inserting a Last Name to the value of 'INVALIDNAME' in a Contact record
For (Contact contact : Trigger.New) {
if(contact.LastName == 'INVALIDNAME') {
contact.AddError('The Last Name "'+contact.LastName+'" is not allowed for Contact records');
}
}
}
@practicalli-johnny
practicalli-johnny / user-behaviours.clj
Created April 25, 2015 12:03
LightTable User Behaviours - jr0cket
;; User behaviors
;; -----------------------------
;; Behaviors are stored as a set of diffs that are merged together
;; to create the final set of functionality that makes up Light Table. You can
;; modify these diffs to either add or subtract functionality.
;;
;; Behaviors are added to tags, objects with those tags then automatically gain
;; whatever logic the behavior imparts. To see a list of user-level behaviors,
;; start typing a word related to the functionality you want in between the square
;; brackets (e.g. "theme").
@practicalli-johnny
practicalli-johnny / emacs-macosx
Last active August 29, 2015 14:20
Script to run Emacs on MacOSX - installed from emacsformacosx.com
#!/bin/sh
## Run Emacs 24 from install of http://emacsformacosx.com
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"