Skip to content

Instantly share code, notes, and snippets.

View madurapa's full-sized avatar

Maduka Jayalath madurapa

View GitHub Profile
@niallobrien
niallobrien / gist:3859740
Created October 9, 2012 16:03
Laravel & Bootstrap ajax modal example
// html
<div>This is my post</div>
<!-- Just put this div at the bottom of your template somewhere-->
<!-- Notice that its hidden by default, so if it doesnt get used, thats fine-->
<div class="modal hide"></div>
//JS
$.ajax({
type: 'post', // or post?
@oquidave
oquidave / _service.md
Created April 1, 2016 10:08 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@sesh
sesh / admin.py
Last active July 18, 2020 05:53
Django Custom User Model
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from .models import User
class CustomUserAdmin(UserAdmin):
fieldsets = (
(None, {'fields': ('email', 'password')}),
@linssen
linssen / the_includes.html
Created May 23, 2012 08:23
Extending the jQuery Sortable With Ajax & MYSQL
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script><link rel='stylesheet' href='styles.css' type='text/css' media='all' />
@knu
knu / sns_update_apns_cert.sh
Created March 8, 2016 11:28
Update an APNS certificate on SNS using aws CLI
arn=arn:aws:sns:...
p12=/path/to.p12
aws sns set-platform-application-attributes --platform-application-arn "$arn" --attributes PlatformCredential="\"$(openssl pkcs12 -in "$p12" -nodes -nocerts)\"",PlatformPrincipal="\"$(openssl pkcs12 -in "$p12" -nodes -nokeys)\""
@carltondickson
carltondickson / gist:ad979cc684027b64c0ff95383ae1c18c
Last active May 30, 2022 03:13
Laravel Queue mailable via tinker
// Create mailable, e.g. MailableTest
php artisan make:mail MailableTest --markdown=emails.mailable-test
// Run horizon or queue worker
// Open tinker
$mailable = (new \App\Mail\MailableTest())->onQueue('queue-name');
Mail::to('somemail@example.com')->send($mailable);
@yajra
yajra / ajax-datatables-expired-session.js
Last active June 30, 2022 20:34
Laravel 5.x solution to redirect AJAX expired session to login page and disable DataTables error prompt
/**
* Requirements:
* - jQuery (http://jquery.com/)
* - DataTables (http://datatables.net/)
* - BootboxJS (http://bootboxjs.com/)
* ---------------------------------------------------------------------------
* Credits to https://gist.github.com/flackend/9517696
* ---------------------------------------------------------------------------
* This monitors all AJAX calls that have an error response. If a user's
* session has expired, then the system will return a 401 status,
@mccarlosen
mccarlosen / PDFViewer.php
Created March 7, 2021 20:14
PDFViewer Livewire Component
<?php
namespace App\Http\Livewire\Components;
use Livewire\Component;
class PdfViewer extends Component
{
public $openModal = false;
public $titleModal = "PDF Viewer";
<?php
//============ ============ ============ ============
// Convert html table to aray
//
// @auth: ViHoangSon
// @since: 20160704092752
//
// Using:
// $contents = "<table><tr><td>Row 1 Column 1</td><td>Row 1 Column 2</td></tr><tr><td>Row 2 Column 1</td><td>Row 2 Column 2</td></tr></table>";
// $array = ConvertHelper::getdata($contents);
@fikrimastor
fikrimastor / app.js
Last active March 26, 2024 23:02
Laravel Vite Compile Tabler Theme Bootstrap 5
import '~tabler/dist/js/tabler.min.js';
import './bootstrap';
import '../sass/app.scss';