Skip to content

Instantly share code, notes, and snippets.

@lukepolo
lukepolo / gulpfile.js
Last active August 29, 2015 14:16
Gulp + Compass + Elixir - Laravel 5
require('dotenv').config();
var gulp = require('gulp'),
sass = require('gulp-sass');
autoprefixer = require('gulp-autoprefixer'),
gutil = require('gulp-util'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
sourcemaps = require('gulp-sourcemaps'),
imagemin = require('gulp-imagemin'),
@lukepolo
lukepolo / gist:2e9e56fd98a2ab1265d8
Created March 17, 2015 20:20
Laravel 5 - Scope Example : By User
// Scope Interface
<?php
namespace App\Models\Scopes;
use Illuminate\Database\Eloquent\ScopeInterface;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class ByUserScope implements ScopeInterface
// Private Routes
Route::group(['middleware' => 'auth' , 'prefix' => $prefix, 'namespace' => 'Modules\Screenshot\Http\Controllers'], function()
{
Route::controllers([
'/' => 'ScreenshotController',
]);
});
// Public Routes
Route::group(['prefix' => $prefix, 'namespace' => 'Modules\Screenshot\Http\Controllers'], function()
var base_path = __dirname.replace('resources/node', '');
require('dotenv').config({
path: base_path + '.env'
});
var env = process.env;
/* Illuminate\Auth\SessionGuard@getName */
var loginSHA1 = 'login_web_59ba36addc2b2f9401580f014c7f58ea4e30989d';
$(document).ready(function()
{
// Set active page
$('a[href$="'+window.location.origin+window.location.pathname+'"]').parent().addClass('active');
// push the state into the history with its content
history.pushState({
"html": $('#content').html()
},
'',
<?php namespace App\Services;
use Exception;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Contracts\Encryption\Encrypter as EncrypterContract;
class Encrypter implements EncrypterContract {
/**
* The encryption key.
@lukepolo
lukepolo / gist:22650f5087e0931ef2f2
Created May 8, 2015 18:39
Real Time Comments - Socket.IO (Part 1)
server = require('http').createServer();
io = require('socket.io')(server);
server.listen(7878, function()
{
console.log('listening on '+ 7878);
});
io.on('connection', function (socket)
<div class="comment-area">
<nav class="navbar">
<div class="container-fluid">
<div>
<ul class="nav navbar-nav">
<li>
<p class="navbar-text"><span class="total_count"></span> Comments</p>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<div data-id="{{ $comment->id }}" class="row comment-row">
<div class="col-xs-1">
<img class="pull-right img-responsive" src="{{ empty($comment->user->profile_img) === false ? $comment->user->profile_img : asset('/img/user.svg') }}">
</div>
<div class="col-xs-11 reply-area">
<div class="row">
<span class="user-name">
{{ $comment->user->first_name }}
{{ $comment->user->last_name }}
</span>
@lukepolo
lukepolo / ubuntu-php7-install.bash
Last active December 25, 2015 10:44
Ubuntu 14.04 PHP7 (Install from Source)
#!/usr/bin/env bash
sudo -i;
apt-get update;
apt-get install --yes \
git \
bison \
autoconf \