Skip to content

Instantly share code, notes, and snippets.

View b4oshany's full-sized avatar

Oshane Bailey b4oshany

View GitHub Profile
@b4oshany
b4oshany / main.ini.php
Created December 27, 2014 08:22
Sample main.ini.php file of Vecni-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 January 9, 2015 05:27
PHP PDO sql file import.
<?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 August 29, 2015 14:13
BootstrapValidator Library of Objects.....
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 August 29, 2015 14:14
GAE-INIT installer
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
@b4oshany
b4oshany / Calendar.php
Created February 4, 2015 07:05
Full Calendar
<?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{
@b4oshany
b4oshany / fullcalendar.js
Created February 4, 2015 07:11
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 August 29, 2015 14:16
Prepopulate PureChat form with the current logged in user.
// JSON data of your current logged in user.
current_user = {"first_name": "Oshane", "last_name": "Bailey", "email": "[email protected]"};
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 September 17, 2015 16:24
ploneformgen mailer
<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 September 17, 2015 17:19
ploneformgen custom mailer
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 September 28, 2015 06:15
Flask mod_wsgi debug mode
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 = '##'