Skip to content

Instantly share code, notes, and snippets.

View billmn's full-sized avatar

Davide Bellini billmn

  • Logistic Design
  • Mantova ( Italy )
  • 14:16 (UTC +02:00)
  • X @billmn
View GitHub Profile
<?php
namespace modules;
use Craft;
use craft\controllers\EntriesController;
use craft\controllers\UsersController;
use yii\base\ActionEvent;
use yii\base\Event;
use yii\base\Module;
use yii\web\ForbiddenHttpException;
@yajra
yajra / DataTable.vue
Last active July 25, 2023 11:06
VueJS DataTables Snippets with Delete Button Component
<template>
<table>
<thead>
<tr>
<th v-for="column in parameters.columns" v-html="title(column)"></th>
</tr>
</thead>
<tfoot v-if="footer">
<tr>
<th v-for="column in parameters.columns" v-html="column.footer"></th>
@pierrehenri220
pierrehenri220 / barba-settings.js
Created December 6, 2016 01:25
Update html head tags with Barba.js
Barba.Dispatcher.on('newPageReady', function(currentStatus, oldStatus, container, newPageRawHTML) {
// html head parser borrowed from jquery pjax
var $newPageHead = $( '<head />' ).html(
$.parseHTML(
newPageRawHTML.match(/<head[^>]*>([\s\S.]*)<\/head>/i)[0]
, document
, true
)
);
var headTags = [
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active May 7, 2024 13:07
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@danharper
danharper / a-FormatController.php
Last active August 1, 2017 12:06
A Laravel Controller which allows you to display API/report data in multiple formats. For example, you may display a preview as HTML, and offer buttons to download as CSV and JSON.
<?php
// this is the base controller which parses output to HTML/CSV/JSON depending on the format in the URL
use Illuminate\Support\Collection;
class FormatController extends Controller {
protected $fileName = 'export';
protected $view = 'reports.output';
@dhayab
dhayab / filters.php
Last active January 25, 2016 16:52
Laravel persistent language prefixing
<?php
App::before(function($request))
{
if ( in_array(Request::segment(1), Config::get('app.languages')) ) {
Session::put('locale', Request::segment(1));
} else {
return Redirect::to(Config::get('app.locale'));
}
if ( Session::has('locale') ) {
@fideloper
fideloper / vhost.py
Last active June 17, 2024 11:58
Create vHost Ubuntu Lamp-Server (bash and python)
#! /usr/bin/python
from sys import argv
from os.path import exists
from os import makedirs
from os import symlink
from os import system
import getopt
#