Skip to content

Instantly share code, notes, and snippets.

@joemaffia
joemaffia / bash_profile
Last active December 6, 2021 17:14
Set $JAVA_HOME Environment Variable On Mac OS X
# OSX 10.5 or later Apple recommends to set the $JAVA_HOME variable to /usr/libexec/java_home
# so just export $JAVA_HOME in file ~/.bash_profile or ~/.profile or ~/.zshrc
# /usr/libexec/java_home return the Java version specified in Java Preferences for the current user.
export JAVA_HOME=$(/usr/libexec/java_home)
#specific version
#export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
@joemaffia
joemaffia / GoodbyeWorldServlet.java
Created October 16, 2013 09:12
Adobe CQ Servlet that will expose the GoodbyeWorldService
package com.company.cq.servlets;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.slf4j.Logger;
@joemaffia
joemaffia / GoodbyeWorldService.java
Last active December 25, 2015 16:19
Adobe CQ OSGi service using SCR annotations.
package com.company.cq.services;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.osgi.framework.Constants;
/**
@joemaffia
joemaffia / GoodbyeWorldTag.java
Last active December 25, 2015 16:19
Adobe CQ JSP Custom Tag
package com.company.cq.taglib;
import com.cqblueprints.taglib.CqSimpleTagSupport;
import com.squeakysand.jsp.tagext.annotations.JspTag;
import com.squeakysand.jsp.tagext.annotations.JspTagAttribute;
import com.englishtown.cq.b2c.services.GoodbyeWorldService;
import java.io.IOException;
@joemaffia
joemaffia / app.js
Last active December 18, 2015 12:19 — forked from viezel/app.js
Codebird for Appcelerator Titanium. Using the Twitter API 1.1
// This is an example of use.
// Here we use the new Bearer Token thats make it possible to get tweets without user login
// More info on Bearer here: https://dev.twitter.com/docs/auth/application-only-auth
// Full Codebird API is here: https://github.com/mynetx/codebird-js
var Codebird = require("codebird");
var cb = new Codebird();
cb.setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET_KEY');
var bearerToken = Ti.App.Properties.getString('TwitterBearerToken', null);
@joemaffia
joemaffia / mac-account.md
Last active December 15, 2015 04:19
Mac locked with password

Boot in single user mode

Command+s

Run

This method tricks OSX into thinking the computer it’s brand new and leads you through the setup to create a new administrator account.

Mount -uw /

Rm /var/db/.AppleSetupDone

@joemaffia
joemaffia / environment.md
Last active December 12, 2015 02:49
Sublime PATH problem

The PATH exposed to GUI apps in OSX is determined by what it's set in ~/.MacOSX/environment.plist

You can see what PATH Sublime is getting from OSX by opening Sublime's console (control-tick) and typing:

import os
os.environ['PATH']

If you don't have that file/folder just create it.

@joemaffia
joemaffia / app.js
Created January 22, 2012 15:04 — forked from pec1985/app.js
LinkedIn effect - Titanium
// right navigation button
var btn = Ti.UI.createButton({
title:'button'
});
// window
var win = Ti.UI.createWindow({
rightNavButton:btn,
backgroundColor:'blue'
});
@joemaffia
joemaffia / mCache.js
Created December 12, 2011 11:39
A cache module for Titanium
/***************************************************
Titanium mCache
Joe Maffia
http://about.me/joemaffia
A cache module to be used for Titanium app. http://www.appcelerator.com/
It uses the local SQLite database to cache strings and JavaScript objects.
Usage: