Skip to content

Instantly share code, notes, and snippets.

View abada's full-sized avatar

Abdulatif Henno abada

View GitHub Profile
@abada
abada / Ti.Geolocation.Example.js
Created April 22, 2017 16:38 — forked from shouse/Ti.Geolocation.Example.js
Ti.Geolocation Example
/***
* @class Lib.TiGeo
* This library is a helper for geolocation
*
* @author Steven House <[email protected]>
* @example
var geo = require('ti.geolocation.helper');
function success(_location) {
console.warn("location callback success");
@abada
abada / citystategeo.js
Created April 17, 2017 06:27 — forked from danasilver/citystategeo.js
Get only city and state from Google Maps API Reverse Geocoder
if (window.navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude,
lng = position.coords.longitude,
latlng = new google.maps.LatLng(lat, lng),
geocoder = new google.maps.Geocoder();
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
for (var i = 0; i < results.length; i++) {
@abada
abada / app.js
Created October 30, 2016 12:28 — forked from appcdr/app.js
Appcelerator: HTTPClient and JSON sample app
Ti.UI.backgroundColor = '#dddddd';
var url = "https://raw.github.com/appcelerator/Documentation-Examples/master/HTTPClient/data/json.txt";
var win = Ti.UI.createWindow();
var table = Ti.UI.createTableView();
var tableData = [];
var json, fighters, fighter, i, row, nameLabel, nickLabel;
var xhr = Ti.Network.createHTTPClient({
onload: function() {
Tested with Laravel 5.2 and 5.3. For more details see: http://laraget.com/blog/how-to-create-an-ajax-pagination-using-laravel
Let's say that we have a simple Laravel webiste with articles.
We want to have Ajax pagination on the page that shows (lists) all of the articles (for example, this page can be accessed from www.example.com/articles and it displays paginated lists of article titles.
The following files are described here:
- resources\views\articles\index.blade.php
- resources\views\articles\load.blade.php
- app\Http\Controllers\ArticleController.php
@abada
abada / AuthServiceProvider.php
Created October 5, 2016 15:46 — forked from gbuckingham89/AuthServiceProvider.php
Blog: Laravel Authentication Customer User Provider Demo
<?php
namespace App\Authentication;
use Auth;
use App\Authentication\UserProvider;
use Illuminate\Support\ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
@abada
abada / 01_Laravel 5 Simple ACL manager_Readme.md
Created September 27, 2016 20:14 — forked from amochohan/01_Laravel 5 Simple ACL manager_Readme.md
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@abada
abada / README
Created September 22, 2016 07:13
Shell script for database backup with AWS.
Must install `AWS CLI` on your server
http://docs.aws.amazon.com/cli/latest/userguide/installing.html
Run backup cron job script
`# crontab -e`
To run aws_database_backup.sh five minutes after midnight, every day, enter:
@abada
abada / AWS database backup
Created September 22, 2016 07:05
Shell script for database backup with AWS.
#!/bin/bash
AWS_ACCESS_KEY_ID=****** \
AWS_SECRET_ACCESS_KEY=****** \
AWS_DEFAULT_REGION=***** \
S3_BUCKET=[bucket name] \
MYSQL_HOST=127.0.0.1 \
MYSQL_PORT=8889 \
MYSQL_USER=root \
MYSQL_PASS=root \
MYSQL_DB=my_db \
@abada
abada / DbOnTheFly.php
Created September 21, 2016 20:22 — forked from digitalkreativ/DbOnTheFly.php
Lumen 5 - On the fly Database connection
<?php
/*******
* Class based on the OTF class made by @lukevers
* https://lukevers.com/2015/03/25/on-the-fly-database-connections-with-laravel-5
* https://gist.github.com/lukevers/2e40dc2dc0cf4818b1ba#file-otf-php
*/
namespace App\Database;
@abada
abada / OTF.php
Created September 21, 2016 20:20 — forked from lukevers/OTF.php
Laravel 5 On The Fly Database Connections
<?php namespace App\Database;
use Config;
use DB;
class OTF {
/**
* The name of the database we're connecting to on the fly.
*