Skip to content

Instantly share code, notes, and snippets.

View gayanhewa's full-sized avatar
🐢

Gayan Hewa gayanhewa

🐢
View GitHub Profile
http://stackoverflow.com/questions/19386962/laravel-eloquent-and-complex-relationships?rq=1
http://forumsarchive.laravel.io/viewtopic.php?pid=21255
http://stackoverflow.com/questions/20666490/laravel-4-mssql-stored-procedure-with-parameters-as-a-prepared-statements
http://culttt.com/2013/08/05/extending-eloquent-in-laravel-4/
http://www.blogosfera.co.uk/2013/08/pass-parameters-in-insert-query-stored-procedure-in-laravel-4/
@gayanhewa
gayanhewa / htaccess
Created November 2, 2014 17:08
Remove index.php from the url
Remove index.php from the url
http://stackoverflow.com/questions/10474740/how-to-remove-index-php-from-urls
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
@gayanhewa
gayanhewa / wifi-reconnect
Last active August 29, 2015 14:07
WIFI disconnection restart script - Realtek drivers
#!/bin/bash
# Unload kernel module , replace rtl8821ae with your device module.
modprobe -r rtl8821ae
#reload kernel module
modprobe rtl8821ae
# set wireless interface to down , replace wlp3s0 with your wifi device name
ip link set wlp3s0 down
#restart wpa_supplicant
systemctl reenable wpa_supplicant
@gayanhewa
gayanhewa / wireless-reload.service
Created October 15, 2014 02:58
Reload wireless on resume - systemd
[Unit]
Description=Restart WiFi on Resume
After=suspend.target
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/bin/modprobe -r rtl8821ae
ExecStart=/usr/bin/modprobe rtl8821ae
ExecStart=/usr/bin/ifconfig wlp3s0 down
@gayanhewa
gayanhewa / upload.php
Created October 5, 2014 16:44
PHP Script to upload files via FTP
<?php
// Ref : http://php.net/manual/en/function.ftp-put.php
$name = "test.txt";
$filename = "/home/mine/Desktop/test.txt";
//-- Code to Transfer File on Server Dt: 06-03-2008 by Aditya Bhatt --//
//-- Connection Settings
$ftp_server = "server_url_here"; // Address of FTP server.
$ftp_user_name = "username_here"; // Username
@gayanhewa
gayanhewa / signature.php
Created September 24, 2014 04:25
HMAC + Sha256 hashed API Auth - This snippet implements the logic behing https://github.com/philipbrown/signplz
<?php
/**
* This snippet implements the logic behing https://github.com/philipbrown/signplz , simply to explain the functionality of generating the auth signature
* for non-php programmers so that they can authenticate with the API without a problem.
**/
$api_key = "key";
$api_sec = "sec";
$url = "http://abc.com/api/test";
@gayanhewa
gayanhewa / sample
Created August 4, 2014 07:56
Spaces.
<?php
$status = 'Image successfully uploaded!';
?>
<?php
class TestCase extends Illuminate\Foundation\Testing\TestCase {
/**
* Creates the application.
*
* @return Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
@gayanhewa
gayanhewa / gist:8bfafa23e97f2114f478
Last active October 18, 2016 06:06 — forked from jagregory/gist:710671
Git Forks
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork git@github...my-fork.git
gayan@gayan-laptop:~/Workspace/personal$ git clone -b develop https://github.com/laravel/laravel.git
Cloning into 'laravel'...
remote: Reusing existing pack: 21846, done.
remote: Total 21846 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (21846/21846), 8.50 MiB | 116.00 KiB/s, done.
Resolving deltas: 100% (10882/10882), done.
Checking connectivity... done.
gayan@gayan-laptop:~/Workspace/personal$ clear
gayan@gayan-laptop:~/Workspace/personal$ ls
git-test laravel last-min.-shopping magelk-charity taskrapp