Skip to content

Instantly share code, notes, and snippets.

View dwelch2344's full-sized avatar

David Welch dwelch2344

View GitHub Profile
@dwelch2344
dwelch2344 / DiscoveryController.java
Created February 24, 2015 16:55
Still crude, but enough to get the picture...
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
var orig = obj.fn;
obj.fn = function(arg1, arg2, arg3){
orig.call(obj, arg1, arg2, arg3);
};
@dwelch2344
dwelch2344 / security.xml
Created February 13, 2015 17:04
An example security xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
@dwelch2344
dwelch2344 / wordpress.sh
Created February 3, 2015 17:35
A simple wordpress setup
# As root
apt-get update
apt-get install -y nginx mysql-server php5-fpm php5-mysql php5-gd libssh2-php unzip
mysql_install_db
mysql_secure_installation
echo 'cgi.fix_pathinfo=0' >> /etc/php5/fpm/php.ini
mysql -u root -p -e "DROP DATABASE IF EXISTS wordpress; CREATE DATABASE wordpress; CREATE USER wpuser@localhost IDENTIFIED BY 'WP_PASSWORD_HERE'; GRANT ALL PRIVILEGES ON wordpress.* TO wpuser@localhost; FLUSH PRIVILEGES;"
wget wordpress.org/latest.zip
unzip latest.zip
rm latest.zip
'use strict';
var gulp = require('gulp'),
prefix = require('gulp-autoprefixer'),
minifyCss = require('gulp-minify-css'),
usemin = require('gulp-usemin'),
uglify = require('gulp-uglify'),
compass = require('gulp-compass'),
minifyHtml = require('gulp-minify-html'),
livereload = require('gulp-livereload'),
@dwelch2344
dwelch2344 / clean.sh
Created January 25, 2015 19:29
Wordpress Hack Cleanup
# List the files
grep -lr --include=*.php "eval(gzinflate(base64_decode" .
# Remove the files
grep -lr --include=*.php "eval(gzinflate(base64_decode" . | xargs sed -i.bak 's/<?php eval(gzinflate(base64_decode[^;]*;/<?php\n/g'
@dwelch2344
dwelch2344 / vhost
Created January 25, 2015 19:00
nginx wordpress vhost
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
client_max_body_size 4M;
root /var/www/wordpress;
index index.html index.php index.htm;
location / {
(function(angular) {
var origMethod = angular.module;
angular.modules = {};
/**
* Register/fetch a module.
*
* @param name {string} module name.
* @param reqs {array} list of modules this module depends upon.
* @param configFn {function} config function to run when module loads (only applied for the first call to create this module).
* @returns {*} the created/existing module.
@dwelch2344
dwelch2344 / example
Last active August 29, 2015 14:08 — forked from anonymous/example
var saved_options = {};
function getOptions(myOption){
if(saved_options[myOption]){
var deferred = $q.defer();
deferred.resolve(saved_options[myOption]);
return deferred.promise;
}else{
return $http({method: 'GET', url:'someUrl'}).then(function(data){
<?php
/*
Plugin Name: QuickTime Movie Player
Plugin URI: http://davidwelch.co/fixme
Description: Plays .mov files
Version: 0.1 BETA
Author: David Welch
Author URI: http://davidwelch.co
*/