Skip to content

Instantly share code, notes, and snippets.

Avatar

Oshane Bailey b4oshany

View GitHub Profile
@b4oshany
b4oshany / main.ini.php
Created Dec 27, 2014
Sample main.ini.php file of Vecni-PHP
View main.ini.php
<?php
# define package usage
use libs\vecni\http\Response;
use libs\vecni\http\Request;
use libs\vecni\Vecni as app;
use libs\vecni\Session as session;
use controller\user\User;
use controller\property;
User::start_session();
@b4oshany
b4oshany / sql_import.php
Created Jan 9, 2015
PHP PDO sql file import.
View sql_import.php
<?php
namespace libs\mysql;
class PDODbImporter{
private static $keywords = array(
'ALTER', 'CREATE', 'DELETE', 'DROP', 'INSERT',
'REPLACE', 'SELECT', 'SET', 'TRUNCATE', 'UPDATE', 'USE',
'DELIMITER', 'END'
);
@b4oshany
b4oshany / bv_address.dm
Last active Aug 29, 2015
BootstrapValidator Library of Objects.....
View bv_address.dm
Lets Call the js below bv.libs.js file.
```Javascript
var bv = {
message: {
notEmpty: 'This field is required and can\'t be empty.'
},
validators:{
enable_only: {
enabled: {
@b4oshany
b4oshany / Makefile
Last active Aug 29, 2015
GAE-INIT installer
View Makefile
APPENGINE_PATH = /usr/local/google_appengine
APPENGINE_APPCFG = /usr/local/google_appengine/appcfg.py
APP_PATH = $(shell pwd)
MAIN_PATH = ${APP_PATH}/main
USER = $(shell whoami)
USER_HOME = /home/${USER}
flush:
python run.py -f
View Calendar.php
<?php
namespace libs\schedule;
require_once "setup.php";
use libs\vecni\Vecni;
use libs\mongodb\Model;
use libs\user\User;
use libs\location\Location;
use libs\schedule\Event;
class Calendar extends Model{
View fullcalendar.js
$(function() {
/* initialize the external events
-----------------------------------------------------------------*/
function ini_events(ele) {
ele.each(function() {
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
// it doesn't need to have a start or end
var eventObject = {
@b4oshany
b4oshany / purechat.js
Last active Aug 29, 2015
Prepopulate PureChat form with the current logged in user.
View purechat.js
// JSON data of your current logged in user.
current_user = {"first_name": "Oshane", "last_name": "Bailey", "email": "test@example.com"};
var purechat_user_interval = {"obj": undefined, "num_tries": 0};
// Initiate the PureChat plugin onload (async). In addition, set the user
// name and email as soon as PureChat initiation process is completed.
(function () {
var done = false;
var script = document.createElement('script');
@b4oshany
b4oshany / mailer.pt
Created Sep 17, 2015
ploneformgen mailer
View mailer.pt
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title></title></head>
<body>
<p tal:content="here/getBody_pre | nothing" />
<dl>
<tal:block repeat="field options/wrappedFields | nothing">
<dt tal:content="field/fgField/widget/label" />
<dd tal:content="structure python:field.htmlValue(request)" />
@b4oshany
b4oshany / custom_mailer.py
Created Sep 17, 2015
ploneformgen custom mailer
View custom_mailer.py
from Products.CMFCore.utils import getToolByName
mailhost = getToolByName(ploneformgen, 'MailHost')
subject = "Email subject"
# Use this logger to output debug info from this script if needed
import logging
logger = logging.getLogger("mailer-logger")
@b4oshany
b4oshany / application.py
Created Sep 28, 2015
Flask mod_wsgi debug mode
View application.py
import config
from flask import Flask
app = Flask(__name__)
app.config.from_object(config)
# Jinja2 templates commenting tags
app.jinja_env.line_statement_prefix = '#'
app.jinja_env.line_comment_prefix = '##'