Skip to content

Instantly share code, notes, and snippets.

@asad01304
asad01304 / www-user-change.md
Created January 10, 2016 13:03
How to change apache2 www data ( solving Symfony cache writing issue in vagrant)

#1. Open apache environment variabled

$ sudo nano /etc/apache2/envvars

#2. Change following 2 lines

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
@asad01304
asad01304 / install_mysql.sh
Last active September 15, 2015 08:48 — forked from rrosiek/install_mysql.sh
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Outputs nearly everything to /dev/null since "quiet" on most commands is still noisy.
#! /usr/bin/env bash
# Variables
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
echo -e "\n--- Mkay, installing now... ---\n"
<?php
$items = array(
'original' => 50,
'v1' => 20,
'v2' => 10,
'v3' => 20,
);
$rand = rand(0,100);
@asad01304
asad01304 / gruntfile.js
Created June 11, 2014 18:29
Sample grunt file
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ";\n"
},
dist: {
// the files to concatenate
src: [
@asad01304
asad01304 / dom-selector.js
Last active January 2, 2016 20:19
the following function calculates a dom's jQ selector
function getXPaths (dom){
//If dom has id and making sure no other dom has the same id
function hasUniquId (dom){
return (dom.id && dom.id.length) && ($("[id="+dom.id+"]").size() > 1);
}
//If dom has any siblings , if yes then it's position
function getPositionInSiblings(dom){
{ vacancies: 1,
description:
[ 'Must be expertise in social media networking, search engine optimization and word press development.',
'PHP',
'Familiarity with the syntax and control structures of the given language.',
'Best practices for efficient and easier to maintain code.',
'Best practices for securing web applications.',
'Inserting, querying and managing data stored in databases or files.',
'Knowledge of PHP and database programming including:',
'The features and syntax of PHP data types, variables, constants and operators.',
@asad01304
asad01304 / deploy.js
Last active December 30, 2015 08:39
Node script Moduler Js deployment script
var _ = require('underscore'), fs = require('fs');
var UglifyJS = require("uglify-js");
var root = 'public/javascripts/modules/';
var modules = ['Hadith'];
var FILE_ENCODING = 'utf-8', EOL = '\n';
_.each(modules, function(module){
@asad01304
asad01304 / scraping-v1.js
Created November 22, 2013 21:00
Dhaka stock exchange current price scraping & saving them in memcache. Used modules "memcache" & "dse-bd"
/* Initializing memcache client */
var host = 'localhost', port = 11212;
var memcache = require('memcache'),
client = new memcache.Client(host, port);
client.port = host
client.host = port;
client.on('connect', function(){ console.log("we've connected"); });
client.on('close', function(){ console.log("connection has been closed"); });
@asad01304
asad01304 / config.js
Last active December 10, 2016 09:39
Mongoose Js bootstrapping
var dbConfig = {
db : null,
host : '127.0.0.1',
port : '27017',
name : 'test',
getConString : function(){
return 'mongodb://' + this.host +
':' + this.port + '/' + this.dbName;