Skip to content

Instantly share code, notes, and snippets.

View bmvakili's full-sized avatar

Bijan Vakili bmvakili

View GitHub Profile
@bmvakili
bmvakili / mysql-command-create-user-backup
Created May 21, 2014 22:23
Mysql grant read-only for backup
grant select, lock tables on *.* to 'backup'@'localhost' identified by 'backup';
@bmvakili
bmvakili / variables.properties
Last active March 7, 2017 19:55
Liferay 6.2 Workflow Notification Freemarker Template Variables
expandoRowLocalService=com.liferay.portlet.expando.service.impl.ExpandoRowLocalServiceImpl@7d62221b
unicodeLanguageUtil=com.liferay.portal.language.UnicodeLanguageImpl@73581bfe
serviceLocator=com.liferay.portal.template.ServiceLocator@1d95fbdb
userGroupPermission=com.liferay.portal.service.permission.UserGroupPermissionImpl@61c9f609
userPermission=com.liferay.portal.service.permission.UserPermissionImpl@1237fb07
staticFieldGetter=com.liferay.portal.kernel.util.StaticFieldGetter@194191e9
imageToken=com.liferay.portal.webserver.WebServerServletTokenImpl@1fd264f3
dateFormatFactory=com.liferay.portal.util.FastDateFormatFactoryImpl@2de19dd7
locationPermission=com.liferay.portal.service.permission.OrganizationPermissionImpl@3741a5c9
organizationPermission=com.liferay.portal.service.permission.OrganizationPermissionImpl@3741a5c9
@bmvakili
bmvakili / freemarker_variables_wcm
Created January 20, 2015 14:23
liferay 6.2 GA2 web content template freemarker variables available
scopeGroupId
expandoRowLocalService
reserved-article-id
unicodeLanguageUtil
serviceLocator
reserved-article-author-email-address
userGroupPermission
userPermission
staticFieldGetter
Images
@bmvakili
bmvakili / kaleoworkflowtemplatevars
Created January 20, 2015 14:25
liferay 6.2 GA2 kaleo wordflow engine freemarker variables available
expandoRowLocalService=com.liferay.portlet.expando.service.impl.ExpandoRowLocalServiceImpl@7d62221b
unicodeLanguageUtil=com.liferay.portal.language.UnicodeLanguageImpl@73581bfe
serviceLocator=com.liferay.portal.template.ServiceLocator@1d95fbdb
userGroupPermission=com.liferay.portal.service.permission.UserGroupPermissionImpl@61c9f609
userPermission=com.liferay.portal.service.permission.UserPermissionImpl@1237fb07
staticFieldGetter=com.liferay.portal.kernel.util.StaticFieldGetter@194191e9
imageToken=com.liferay.portal.webserver.WebServerServletTokenImpl@1fd264f3
dateFormatFactory=com.liferay.portal.util.FastDateFormatFactoryImpl@2de19dd7
locationPermission=com.liferay.portal.service.permission.OrganizationPermissionImpl@3741a5c9
organizationPermission=com.liferay.portal.service.permission.OrganizationPermissionImpl@3741a5c9
@bmvakili
bmvakili / binarysearch.js
Last active August 29, 2015 14:13
binary search javascript
/**
* binarySearch
* efficiently searching a sorted list
* list - array of values sorted in ascending order
* value - the target value to search for
* @author Bijan Vakili
*/
function binarySearch(list, value) {
var found = -1,
delta = Math.floor(list.length / 2),
@bmvakili
bmvakili / jssetintersection.js
Last active August 29, 2015 14:13
Set with intersection
/**
* Set intersect
* The algorithm is provided by Ophir LOJKINE. I modified it to work for sets.
* @author Ophir LOJKINE
* https://gist.github.com/lovasoa/3361645
* @author Bijan Vakili
*/
Set.prototype.intersect = function() {
var i, all, shortest, nShortest, n, len, ret = [], obj={}, nOthers;
arguments[arguments.length++] = this;
@bmvakili
bmvakili / table.js
Created January 20, 2015 20:00
table
function jsonTable() {
var data = {
headers: ["First Name", "Last Name", "Age"],
rows: [
["John", "Doe", 30],
["Jane", "Doe", 27],
["Mac", "Smith", 52]
]
};
@bmvakili
bmvakili / checkerboard.js
Created January 21, 2015 20:15
25x25 checker board javascript
/**
* Create 25x25 checker board and add hover and click listeners.
* Hovering should cross-hair column and row-wise boxes.
* Clicking should toggle box color to red.
* Clicking back space should reset colors to default.
* @author Bijan Vakili
*/
$( document ).ready( function() {
var efficientContainer = '#result-efficient',
@bmvakili
bmvakili / checkerboard.css
Last active August 29, 2015 14:13
25x25 checker board css
.box-wrapper {
width: 250px;
height: 250px;
}
.box-wrapper > .box{
background: #000;
width: 8px;
height: 8px;
float: left;
@bmvakili
bmvakili / partialbinarysearchtree.js
Last active August 29, 2015 14:13
Partial Binary Search Tree and Node implementation
/**
* Partial Binary Search Tree class.
* @author Bijan Vakili
*/
var Node = function() {
// Private variable to access 'this' context from privileged method
var that = this;
// Public variables