Skip to content

Instantly share code, notes, and snippets.

View tacone's full-sized avatar
💭
¯\_(ツ)_/¯

tacone

💭
¯\_(ツ)_/¯
View GitHub Profile
@tacone
tacone / tinymce.js
Created June 23, 2016 10:53
TinyMce with file upload
$(function () {
var editorCount = 0;
$('.richtext').each(function () {
var sendFile = function (callback) {
data = new FormData();
data.append("file", fileInput[0].files[0]);
$.ajax({
url: "/upload/image",
<?php
namespace App;
use Illuminate\Database\QueryException;
class Increments
{
public static function generate($key)
{
@tacone
tacone / mysql-backup-tables.sh
Created May 13, 2016 14:16
Backup all mysql tables
#!/bin/sh
#
# Adapted from: https://www.howtoforge.com/shell-script-to-back-up-all-mysql-databases-each-table-in-an-individual-file-and-upload-to-remote-ftp
#
# System + MySQL backup script
# Copyright (c) 2008 Marchost
# This script is licensed under GNU GPL version 2.0 or above
# ---------------------------------------------------------------------
#########################
@tacone
tacone / wp-sync.sh
Last active October 5, 2023 06:08
Quick script to sync your dev box to a production Wordpress
#!/bin/bash
# Syncronize a local Wordpress installation with a remote one.
#
#
# Requires wp-cli.phar installed somewhere.
WP_CLI=/usr/local/bin/wp
# Remote settings
@tacone
tacone / bench.php
Created October 12, 2015 21:03
Arrays and iterators benchmark
<?php
class Aggregate implements \IteratorAggregate
{
protected $var;
public function __construct($var = null)
{
if (is_array($var)) {
$this->var = new ArrayIterator($var);
@tacone
tacone / Multiselect.php
Created October 10, 2015 15:13
Multiselect field with Zofe/Rapyd
<?php namespace Zofe\Rapyd\DataForm\Field;
use Illuminate\Support\Facades\Form;
class Multiselect extends Field
{
public $type = "checks";
public $multiple = true;
public $size = null;
public $description = "";
@tacone
tacone / MigrateDone.php
Created July 19, 2015 13:53
How to mark Laravel 4 migrations as done without executing them
<?php
use Illuminate\Database\Console\Migrations\BaseCommand;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Database\Migrations\Migrator;
use Symfony\Component\Console\Input\InputOption;
class MigrateDone extends BaseCommand
{
@tacone
tacone / gulpfile.js
Last active August 29, 2015 14:23
This is my gulpfile. There are many like it, but this one is mine.
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin'),
cache = require('gulp-cache');
var minifycss = require('gulp-minify-css');
# ---------------------------------------------------------------------- #
# Target DBMS: MySQL 5 #
# Project name: Northwind #
# Author: Valon Hoti #
# Created on: 2010-07-07 20:00 #
# ---------------------------------------------------------------------- #
DROP DATABASE IF EXISTS northwind;
CREATE DATABASE IF NOT EXISTS northwind;
@tacone
tacone / gist:fabce42b46991702b458
Last active July 24, 2016 23:29
Bookmarklet to replace a textarea with a code editor
javascript: function loadScripts(array, callback) {
var loader = function(src, handler) {
var script = document.createElement("script");
script.src = src;
script.onload = script.onreadystatechange = function() {
script.onreadystatechange = script.onload = null;
handler();
};
var head = document.getElementsByTagName("head")[0];
(head || document.body).appendChild(script);