Skip to content

Instantly share code, notes, and snippets.

View tarex's full-sized avatar
🎯
Focusing

Tareq Jobayere tarex

🎯
Focusing
View GitHub Profile
/**
* Filter to check for CSRF attacks from the ajax requests.
*/
Route::filter('csrf_header', function()
{
if (Session::token() != Request::header('x-csrf-token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
});
myApp.filter('filterMultiple',['$filter',function ($filter) {
return function (items, keyObj) {
var filterObj = {
data:items,
filteredData:[],
applyFilter : function(obj,key){
var fData = [];
if (this.filteredData.length == 0)
this.filteredData = this.data;
if (obj){
@tarex
tarex / functions.php
Last active August 29, 2015 14:05
Add custom log into WordPress
<?php
if(!function_exists('_log')){
function _log( $message ) {
if( WP_DEBUG === true ){
if( is_array( $message ) || is_object( $message ) ){
error_log( print_r( $message, true ) );
} else {
error_log( $message );
}
@tarex
tarex / bootstrap-problem.md
Created August 27, 2014 19:13
get rid from .map file 404 issue bootstrap

Just remove the line from bootstrap.css

/*# sourceMappingURL=bootstrap.css.map */

To hide iterm from the dock

/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist

And this to undo:

/usr/libexec/PlistBuddy -c 'Delete :LSUIElement' /Applications/iTerm.app/Contents/Info.plist

Bower-installer was written as a command-line app and doesn't yet expose an API. You could just use exec if you want to:

var exec = require('child_process').exec;

gulp.task('task', function (cb) {
  exec('bower-installer', function (err, stdout, stderr) {
    console.log(stdout);
    console.log(stderr);
    cb(err);

});

@tarex
tarex / functions.php
Created August 31, 2014 15:02
wp breadcumbs
<?php
/**
*######################################################################
*# breadcrumbs
*######################################################################
*/
@tarex
tarex / app.js
Created September 11, 2014 12:22
Press Enter to do something
app.directive('ngEnter', function () {
return function (scope, element, attrs) {
element.bind("keydown keypress", function (event) {
if(event.which === 13) {
scope.$apply(function (){
scope.$eval(attrs.ngEnter);
});
event.preventDefault();
}
@tarex
tarex / install.md
Last active August 29, 2015 14:13 — forked from zaherg/install.md

Creating Your Laravel & nginx Server

We will install Larave 4.1 with PHP5.5 & Latest nginx on Ubuntu 12.04.3 x64.

updating your system

apt-get update && apt-get upgrade
adduser [username]
usermod -aG sudo [username]
apt-get -y install git
@tarex
tarex / tinymce.js
Created January 31, 2015 12:53
wordpress tinymce directive for angular
/**
* Binds a TinyMCE widget to <textarea> elements.
*/
angular.module('ui.tinymce', [])
.value('uiTinymceConfig', {})
.directive('uiTinymce', ['uiTinymceConfig', function(uiTinymceConfig) {
uiTinymceConfig = uiTinymceConfig || {};
var generatedIds = 0;