Skip to content

Instantly share code, notes, and snippets.

View gabriel403's full-sized avatar
💭
Hotty

Gabriel Baker gabriel403

💭
Hotty
View GitHub Profile
if (e instanceof KeyboardEvent) {
if (e.keyCode != keys.ENTER) {
return;
}
}
try {
List<IdmDataItem> additionalRequestItems = this.request.getRequestData().getAdditionalData().getItem();
} catch(NullPointerException e) {
List<IdmDataItem> additionalRequestItems = new List<IdmDataItem>();
}
input {
amqp {
auto_delete => false
durable => true
exchange => "router"
exclusive => false
format => "json"
host => "loggingqueue.dev"
passive => false
password => "pword"
$data = [];
$data['first_name'] = $this->params()->fromPost('first_name', '');
$data['last_name'] = $this->params()->fromPost('last_name', '');
$form = $this->getUserService()->getUserForm();
$form->setHydrator(new \Zend\Stdlib\Hydrator\ClassMethods);
$form->bind($user);
$form->setData($data);
\Zend\Debug\Debug::dump($form->get('user_auth_email')->getValue());
filter {
grok {
type => 'apache-error'
pattern => "\[%{DATA:timestamp}\] \[%{WORD:loglevel}\] \[%{WORD:originator} %{IP:clientip}\] %{GREEDYDATA:errmsg}"
add_tag => "apache"
}
date {
type => "apache-error"
timestamp => "%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}"
}
class projects::queuesystem::butts(
$jarbase = 'https://logstash.objects.dreamhost.com/release',
$jarfile = 'logstash-1.1.13-monolithic.jar',
$jarpath = "/tmp/$jarfile",
$jdk = 'openjdk-7-jre-headless',
$installpath = '/opt/logstash'
) {
Exec { path => '/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin'}
input {
stdin {
type => "stdin-type"
}
}
output {
elasticsearch {
embedded => false
host => "localhost"
}
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.0.deb
sudo dpkg -i elasticsearch-0.90.0.deb
@gabriel403
gabriel403 / Module.php
Created July 3, 2013 19:49
Returning json error to an xhr request
$sharedEvents = $e->getTarget()->getServiceManager()->get('SharedEventManager');
$sharedEvents->attach('Zend\Mvc\Application', 'dispatch.error', function ($event){
//do magic
});
$output = fopen("php://output",'w') or die("Can't open php://output");
header("Content-Type:application/csv");
header("Content-Disposition:attachment;filename=pressurecsv.csv");
fputcsv($output, ['email','status','created on', 'end date', 'last logged in', 'sales email']);
foreach($contentArray as $content) {
fputcsv($output, $content);
}
fclose($output) or die("Can't close php://output");
exit;