Skip to content

Instantly share code, notes, and snippets.

View thedevsaddam's full-sized avatar
🏴‍☠️
Wherever we want to go, we'll go!

Saddam H thedevsaddam

🏴‍☠️
Wherever we want to go, we'll go!
View GitHub Profile
@thedevsaddam
thedevsaddam / laravel.js
Last active December 3, 2015 07:50 — forked from soufianeEL/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` and `data-token="{{csrf_token()}}"` attributes.
/*
Exemples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
*/
(function() {
@thedevsaddam
thedevsaddam / Bootstrap-3_Carousel-Collection
Created December 27, 2015 05:45 — forked from loschke/Bootstrap-3_Carousel-Collection
Bootstrap 3 - Carousel Collection Pack
@thedevsaddam
thedevsaddam / array.functions.php
Created December 27, 2015 05:46 — forked from loschke/array.functions.php
Nützliche Funktionen zur Arbeit mit Array
<?php
//check if an array is associative
function isAssocArray($array){
return array_keys($array) !== range(0, count($array) - 1);
}
//check if an array is multidimensional
function isMultiArray($array) {
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Http\Response;
class CORS implements Middleware {
/**
* Handle an incoming request.
@thedevsaddam
thedevsaddam / redis-delallbykey
Created August 20, 2016 12:54 — forked from mattweyant/redis-delallbykey
Delete all keys from Redis matching a regular expression
# All credit: http://stackoverflow.com/questions/4006324/how-to-atomically-delete-keys-matching-a-pattern-with-redis
redis-cli [options] KEYS "prefix:*" | xargs redis-cli [options] DEL
@thedevsaddam
thedevsaddam / mysql_dump_migration.php
Created August 30, 2016 06:13 — forked from scrubmx/mysql_dump_migration.php
Import mysql dump as laravel migration
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePostalCodesTable extends Migration {
/**
* Run the migrations.
*
@thedevsaddam
thedevsaddam / compat_l5.php
Created October 16, 2016 17:58 — forked from vluzrmos/compat_l5.php
Lumen L5 compatibility helpers. That file should be added on root path of your project... and added to your composer.json
<?php
if(!function_exists('config_path'))
{
/**
* Return the path to config files
* @param null $path
* @return string
*/
function config_path($path=null)
@thedevsaddam
thedevsaddam / WriteFile.go
Created January 16, 2017 05:19 — forked from pagoenka/WriteFile.go
Writing to file in Go lang
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
@thedevsaddam
thedevsaddam / appendWrite.go
Created January 16, 2017 05:19 — forked from pagoenka/appendWrite.go
Append to file in Go lang
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
@thedevsaddam
thedevsaddam / ReadFile.go
Created January 16, 2017 05:20 — forked from pagoenka/ReadFile.go
Reading file, line by line in Go lang using scanner
package main
import (
"bufio"
"fmt"
"os"
)
func main() {