Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Samsotha psamsotha

View GitHub Profile
@psamsotha
psamsotha / disable_woocommerce_shop_links.php
Created Mar 20, 2018
Little script to disable shop links in Woocommerce
View disable_woocommerce_shop_links.php
@psamsotha
psamsotha / purgeAndroid.txt
Created Feb 11, 2018 — forked from tahmidsadik/purgeAndroid.txt
How to completely remove Android Studio from Mac OS X
View purgeAndroid.txt
How to Completely Remove Android Studio
Execute these commands from the terminal
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
@psamsotha
psamsotha / CompositionTest.java
Created Jan 26, 2018
Example of using JerseyTest without extending it.
View CompositionTest.java
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Application;
View InjectionTest.java
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.glassfish.jersey.test.DeploymentContext;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.ServletDeploymentContext;
import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory;
import org.glassfish.jersey.test.spi.TestContainerFactory;
import org.junit.Test;
View MapAdapter.java
public class MapAdapter extends XmlAdapter<MapAdapter.MapLike, Map<String, String>> {
public static class Entry {
public String value;
public String key;
public Entry() {}
public Entry(String value, String key) {}
}
public static class MapLike {
@psamsotha
psamsotha / uploadtest.jsp
Created Nov 29, 2017 — forked from tveimo/uploadtest.jsp
single submit file upload example with the jquery file upload plugin: https://github.com/blueimp/jQuery-File-Upload
View uploadtest.jsp
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//blueimp.github.io/jQuery-File-Upload/js/vendor/jquery.ui.widget.js"></script>
<script src="//blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script>
<script src="//blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script>
<script src="//blueimp.github.io/jQuery-File-Upload/js/jquery.iframe-transport.js"></script>
<script src="//blueimp.github.io/jQuery-File-Upload/js/jquery.fileupload.js"></script>
@psamsotha
psamsotha / css-selectors.md
Created Nov 4, 2017 — forked from magicznyleszek/css-selectors.md
CSS Selectors Cheatsheet
View css-selectors.md

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
View scp-cheatsheet.md

Basic Syntax

$ scp source_file_path destination_file_path

Uploading

Single file

@psamsotha
psamsotha / postgres-cheatsheet.md
Created Oct 11, 2017 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet
View postgres-cheatsheet.md

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@psamsotha
psamsotha / gist:6b836c7d356944737183beb6d6c8139c
Created Sep 5, 2017 — forked from wacko/gist:5577187
SSH between Mac OS X host and Virtual Box guest
View gist:6b836c7d356944737183beb6d6c8139c

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0

You can’t perform that action at this time.