Skip to content

Instantly share code, notes, and snippets.

View gabriel403's full-sized avatar
💭
Hotty

Gabriel Baker gabriel403

💭
Hotty
View GitHub Profile
@gabriel403
gabriel403 / gist:2422345
Created April 19, 2012 17:07
When posting and specifying an obj in the args where the member vars of the obj match to the names of form elements
//object
namespace something
{
public class SomeObj
{
public string SomeStr;
}
}
//view with a form that posts to SomePostedAction
@gabriel403
gabriel403 / dojo Label Object
Created August 28, 2012 11:54
Creating a label for a dojo widget
var container = domConstruct.create("div", {'id':'TreeEditContainer'}, win.body());
var form = new Form().placeAt(container);
var langSelect = new Select({
name: "LanguageSelect",
options: [
{ label: "en_gb", value: "en_gb" }
]
});
var label = new Label({'widget':langSelect,'container':form, 'label':'Some label'});
label.makelabel();
define(["dojo/_base/declare", "dojo/_base/lang", "dojo/dom-construct", "dijit/_WidgetBase"],
function(declare, lang, domConstruct, _WidgetBase){
return declare("Fieldset", [_WidgetBase], {
container: null,
legend: '',
fieldsetTag: 'fieldset',
legendTag: 'legend',
buildRendering: function(){
this.domNode = domConstruct.create(this.fieldsetTag, {id: this.id});
domConstruct.create(this.legendTag, {'innerHTML': this.legend}, this.domNode);
[gabriel@RedDwarf ZendSkeletonApplication]$ git reset --hard zsa/master
HEAD is now at a6cb03e Merge pull request #124 from wshafer/master
[gabriel@RedDwarf ZendSkeletonApplication]$ git push origin
Everything up-to-date
[gabriel@RedDwarf ZendSkeletonApplication]$
@gabriel403
gabriel403 / getterSetterBase.js
Created October 3, 2012 11:00
a simple base class for having setters and getters by default
define(["dojo/_base/declare", "dojo/_base/lang", "gmk/library/utilities/string"],
function(declare, lang, strUtil){
return declare([ ], {
get: function(varName) {
var retVal = null;
if ( "function" == typeof lang.getObject("get"+strUtil.ucfirst(varName), false, this) ) {
retVal = lang.getObject("get"+strUtil.ucfirst(varName), false, this)();
} else {
retVal = lang.getObject(varName, false, this);
}
@gabriel403
gabriel403 / DifferenceDatabaseFactory.php
Created November 20, 2012 13:47
SM with factories and SM config in application.ini
class DifferenceDatabaseFactory implements FactoryInterface {
public createService(ServiceManager $sm) {
$tableman = $sm->get('tableManager');
$table = $tableman->get('differencetable');
$diffdb = new DifferenceDatabase($table);
return $diffdb;
}
}
$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;
@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
});
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
input {
stdin {
type => "stdin-type"
}
}
output {
elasticsearch {
embedded => false
host => "localhost"
}