Skip to content

Instantly share code, notes, and snippets.

View JohnLockwood's full-sized avatar
💭
Organizing repos 🔢

John Lockwood JohnLockwood

💭
Organizing repos 🔢
View GitHub Profile
@JohnLockwood
JohnLockwood / git_tasks.rake
Created November 4, 2012 15:31
Some Rake Tasks to Automate Common Git Tasks -- I use this at johnlockwood.com.
# Use rake --tasks | grep git for a list
# The most useful is rake git:checkin, which is essentially add + commit + message + push.
namespace :git do
desc "Run ssh-add to enter password for your ssh key a single time"
task :setup do
sh "ssh-add"
end
@JohnLockwood
JohnLockwood / application.html.haml
Created November 10, 2012 17:15
A sample application.html.haml file, based on the application.html.erb from ruby-devise-mongoid.
!!!
%head
%title= content_for?(:title) ? yield(:title) : I18n.t("site_title")
%meta{:name => "description", :content=> "#{ content_for?(:description) ? yield(:description) : (I18n.t "site_description")}"}
%meta{:charset => "utf-8"}
%meta{:author => "John Lockwood"}
=stylesheet_link_tag "application", :media => "all"
=javascript_include_tag "application"
=csrf_meta_tags
= yield(:head)
@JohnLockwood
JohnLockwood / application.html.erb
Created November 10, 2012 17:39
Translating applicaiton.html.erb to HAML -- this file is translated with modifications in https://gist.github.com/4051775
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= content_for?(:title) ? yield(:title) : "Rails3 Mongoid Devise" %></title>
<meta name="description" content="<%= content_for?(:description) ? yield(:description) : "Rails3 Mongoid Devise" %>">
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
@JohnLockwood
JohnLockwood / gist:f4889418071b8d13afb4
Created February 28, 2015 12:09
Primefaces starter pom based on maven archetype -- bash script
mvn archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-webapp \
-DgroupId=com.codesolid.primefaces \
-DartifactId=pom1
@JohnLockwood
JohnLockwood / index.xhtml
Last active August 29, 2015 14:16
Just a preliminary index page for a JSF demo site.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>JavaCodeGeeks</title>
</h:head>
<h:body>
<p><h:outputText value="#{helloWorldBean.msg}"/></p>
#
# A proof of concept for an alternative to Flask-restful that supports GET (for an id) and GET (for a list of objects) on the same
# object -- not to mention POST (don't-know-the-id-yet) and PUT (sure I do).
#
# Usage in the file that defines the Blueprint looks like:
# api_v1_root = '/api/v1'
# v1_api = Blueprint('api/v1', __name__, url_prefix=api_v1_root)
# poc = ProofOfConcept("/poc")
# poc.register_routes(v1_api)
/*
Well yes, this is awfully basic, but the real point is to see if we can embed it in
a Wordpress site and retain the syntax highlighting.
*/
public class HelloWorld {
public static void main(String [] args) {
System.out.println("Hello world");
}
}
@JohnLockwood
JohnLockwood / MyStepName.java
Last active December 4, 2017 13:43
Help Button for Pentaho PDI Custom Step Dialog
public class MyStepNameDialog extends BaseStepDialog implements StepDialogInterface {
// ...
/*
This example shows how to implement a help button in a PDI custom step dialog. This assumes
that you're including a docs directory in your deployment zip, with a help file in HTML format
named "MyStepName.html"
@JohnLockwood
JohnLockwood / ami_lookup.py
Created May 18, 2018 20:25
Given an AWS AMI ID and a region where that AMI is found, create a RegionMap for use with Amazon CloudFormation. Dependencies pip install boto3 pip install docopt
"""AMI Lookup.
Given an AWS AMI ID and a region where that AMI is found, create a RegionMap
for use with Amazon CloudFormation.
Note it assumes your AWS credentials are set up according to the boto3 guide.
http://boto3.readthedocs.io/en/latest/guide/configuration.html.
TODO more error handling etc
@JohnLockwood
JohnLockwood / 100-days-of-commits.md
Created December 11, 2021 07:17
100 Days of Commits (Experimental)

100 Days of commits