Skip to content

Instantly share code, notes, and snippets.

View pschichtel's full-sized avatar

Phillip Schichtel pschichtel

View GitHub Profile
@pschichtel
pschichtel / puma.rb
Last active December 20, 2015 00:39 — forked from thanhhh/puma.rb
default puma configuration for Redmine, but can be used for any ruby app
#!/usr/bin/env puma
# Start Puma with next command:
# RAILS_ENV=production bundle exec puma -C ./config/puma.rb
# uncomment and customize to run in non-root path
# ENV['RAILS_RELATIVE_URL_ROOT'] = "/redmine"
application_path = '/home/redmine/redmine'
@pschichtel
pschichtel / Redmine installation
Last active December 20, 2015 00:39 — forked from thanhhh/Redmine installation
How to configuration Redmine with puma and running on nginx (based on Gitlab's installation)
Add config/puma.ruby
--------------------
cd /home/redmine/redmine
sudo -u redmine -H curl --output config/puma.rb https://gist.github.com/quickwango/6043161/raw/fdfe2a865c3a0afe912c8784c971ea7ca3e64cfd/puma.rb
Install Init Script
--------------------
Download the init script (will be /etc/init.d/redmine):
@pschichtel
pschichtel / gist:4019519
Created November 5, 2012 18:43
example permissions definition
permissions:
essentials:
heal:
- create
- remove
sell:
- create
commands:
- *
#!/bin/sh
cd /dev
for i in `ls sd??`
do
echo "Mounting $i..."
mkdir /mnt/$i 2>/dev/null
if (mount /dev/$i /mnt/$i)
then
@pschichtel
pschichtel / gist:3690895
Created September 10, 2012 13:27
thank you Bukkit...
private static boolean languageWorkaroundInitialized;
private static Field localeStringField;
private static Field handleField;
private static Field localeField;
static
{
try
{
localeStringField = Class.forName("net.minecraft.server.LocaleLanguage").getDeclaredField("d");
name: test
revision: 1
description: I am a boring description
dependencies:
- 'other module'
soft-dependencies:
- 'other module'
public interface Converter<T>
{
public Object from(T object);
public T to(Object object);
}
<?php
class TestController implements Controller
{
/**
* @validate id numeric
* @validate message maxlen(300)
* @method post
* @ajax false
*/
public static String getModuleFromStacktrace()
{
final String className = Thread.currentThread().getStackTrace()[2].getClassName();
return className.substring(0, className.indexOf(".", 0));
}
@pschichtel
pschichtel / gist:2795651
Created May 26, 2012 23:50
full annotated command
@Alias( // specifies an alias command for this command
names = {"aliasCOmmand", "shorter"}, // the alias names, first is the main name
parentPath = {"root","sub", "subsub"} // optional: the command path under which the alias should be registered (default: root)
)
@Command( // annotates the method as a command and provides all needed information
names = {"mycommand", "myalias"}, // command names, first is the main name
min = 2, // optional: the minimum number of indexed parameters
max = 7, // optional: the maximum number of indexed parameters
permission = true, // optional: whether to check a permission (default: true)
permissionNode = "my.permission.node" // optional: the permission to check, will be generated if not given