Skip to content

Instantly share code, notes, and snippets.

View sebastiaanluca's full-sized avatar
👋

Sebastiaan Luca sebastiaanluca

👋
View GitHub Profile
@purwandi
purwandi / deploy.rb
Created November 19, 2012 13:09
Laravel Capistrano Receipes
set :application, "App Name" # Your app name
set :repository, "git@github.com:xxxxx/xxx.git" # Your git repository
set :document_root, "/home/user/www/awesome_app"
set :deploy_via, :remote_cache
# SSH Settings
set :user, "user_ssh"
set :password, "password_ssh"
set :use_sudo, false
@chsh
chsh / run_bg.swift
Created December 31, 2014 08:34
Run NSTask in background for Swift
var taskQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)
dispatch_async(taskQueue, { () -> Void in
let task = NSTask()
task.launchPath = "/bin/ls"
task.arguments = []
let pipe = NSPipe()
task.standardOutput = pipe
task.launch()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
var dataString = NSString(data: data, encoding: NSUTF8StringEncoding)
@freekmurze
freekmurze / validate.md
Last active February 15, 2018 17:29
A handy validate function for Laravel 5
/**
 * Validate some data.
 *
 * @param string|array $fields
 * @param string|array $rules
 * @return bool
 */
function validate($fields, $rules)
{
@mklnz
mklnz / capistrano_sudo_helpers.rb
Created April 17, 2012 18:12
Sudo put and template methods for Capistrano
# I got tired of uploading to /tmp then moving to the correct location, so these two convenience methods will save you a lot of time in the long run.
# Helper method to upload to /tmp then use sudo to move to correct location.
def put_sudo(data, to)
filename = File.basename(to)
to_directory = File.dirname(to)
put data, "/tmp/#{filename}"
run "#{sudo} mv /tmp/#{filename} #{to_directory}"
end
@akoepcke
akoepcke / .bash_profile
Created August 31, 2018 08:11
composer-link()
// Require local folder as Composer dependency
// whereas _package_ is a unique package ID to keep composer from overwriting existing config
//
// from within the project folder, run the following:
// composer-link /path/to/package package
// Then run composer require as usual.
composer-link() {
composer config repositories."$2" '{"type": "path", "url": "'$1'"}' --file composer.json
}
@ninjaparade
ninjaparade / .postcssrc.js
Created August 30, 2018 18:31
Purge CSS in vue cli app
const tailwindcss = require('tailwindcss')
const purgecss = require('@fullhuman/postcss-purgecss')
const autoprefixer = require('autoprefixer')
const postcssImport = require('postcss-import')
module.exports = {
plugins: [
postcssImport,
tailwindcss('./tailwind.js'),
purgecss({
@rikh42
rikh42 / gist:efad95142b1be3429a94
Last active March 23, 2019 18:42
Laravel Homestead XDebug Nginx and Composer config changes

Laravel Homestead XDebug Nginx and Composer config changes

/etc/nginx/fastcgi_params

Update nginx config to support a longer timeout to prevent it dropping the connection when trying to debug in PHP Storm

fastcgi_read_timeout 600; # Set fairly high for debugging
@sgpopov
sgpopov / ruleset.xml
Last active July 15, 2019 10:07
PHP Code Sniffer Rules
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="MentorMate">
<description>
The coding standard of the MentorMate team, based on the Generic, PSR2,
Squiz and Zend coding standards.
</description>
<arg name="colors"/>
<ini name="memory_limit" value="128M"/>
@themsaid
themsaid / pagination.blade.php
Created April 21, 2017 12:57
Pagination view for UIkit
@if ($paginator->hasPages())
<ul class="uk-pagination">
@if ($paginator->onFirstPage())
<li class="uk-disabled"><a href="#"><span uk-pagination-previous></span></a></li>
@else
<li><a href="{{ $paginator->previousPageUrl() }}"><span uk-pagination-previous></span></a></li>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
@plapier
plapier / LaunchStarter.swift
Created May 23, 2015 23:45
Add Login item using Launch Services (Shared List File) in Swift
//
// toggleLaunchAtStartup.swift
// Recents
//
// Created by Phil LaPier on 5/21/15.
// Copyright (c) 2015 Philip LaPier. All rights reserved.
//
// With help from: https://github.com/RamonGilabert/Prodam/blob/master/Prodam/Prodam/LaunchStarter.swift
import Foundation