Skip to content

Instantly share code, notes, and snippets.

View rakeshtembhurne's full-sized avatar
😉
Writing a Book

Rakesh Tembhurne rakeshtembhurne

😉
Writing a Book
View GitHub Profile
@rakeshtembhurne
rakeshtembhurne / .gitignore
Created October 2, 2012 05:53
CakePHP: default .gitignore file
# Test URI
# Ignore netbeans folder
nbproject/*
# Ignore private folder
/app/private/*
!/app/private/empty
# Ignore packed asset files
/app/webroot/css/packed/*
<?php
/**
* MultivalidatableBehabior for CakePHP2
*
* @uses ModelBehavior
* @author Dardo Sordi>
* @link http://bakery.cakephp.org/articles/dardosordi/2008/07/29/multivalidatablebehavior-using-many-validation-rulesets-per-model
*/
class MultivalidatableBehavior extends ModelBehavior
{
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT HEAD~1 HEAD | xargs tar -rf ~/exports/export.tar
@rakeshtembhurne
rakeshtembhurne / ExampleActivation.php
Last active August 29, 2015 14:10 — forked from bumuckl/activation method
Croogo: Code for installing tables while activating croogo plugin
<?php
App::import('Model', 'CakeSchema');
App::import('Model', 'ConnectionManager');
include_once(APP.'plugins'.DS.'pluginname'.DS.'config'.DS.'schema'.DS.'schema.php');
$db = ConnectionManager::getDataSource('default');
//Get all available tables
$tables = $db->listSources();
$CakeSchema = new CakeSchema();
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@rakeshtembhurne
rakeshtembhurne / aggregate.js
Created December 10, 2015 06:24
Aggregate data from MongoDB with Node.js and mongoose
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
//Database connection
var uristring = 'mongodb://localhost/test';
var mongoOptions = { };
mongoose.connect(uristring, mongoOptions, function (err, res) {
if (err) {
console.log('Error when connecting to: ' + uristring + '. ' + err);
@rakeshtembhurne
rakeshtembhurne / __FILE__.js
Created June 10, 2016 12:27 — forked from plepe/__FILE__.js
__FILE__ in JavaScript
/***
* This gist provides a __FILE__ variable, which holds the path to the file
* from which the currently running source is being executed.
*
* Usage example: alert(__FILE__);
*
* Thanks to http://ejohn.org/blog/__file__-in-javascript/ on which this gist
* is based on.
*
* Tested in Mozilla Firefox 9, Mozilla Firefox 16, Opera 12, Chromium 18

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@rakeshtembhurne
rakeshtembhurne / bash_aliases
Created November 16, 2016 06:06 — forked from frdmn/bash_aliases
Nginx and PHP-FPM configuration + default virtual host
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.restart='nginx.stop && nginx.start'
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist"
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist"
alias php-fpm.restart='php-fpm.stop && php-fpm.start'
alias mysql.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.restart='mysql.stop && mysql.start'
alias nginx.logs.error='tail -250f /usr/local/etc/nginx/logs/error.log'
@rakeshtembhurne
rakeshtembhurne / default
Created July 19, 2017 11:25 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}