Skip to content

Instantly share code, notes, and snippets.

View gayanhewa's full-sized avatar
🦧
I may be slow to respond.

Gayan gayanhewa

🦧
I may be slow to respond.
View GitHub Profile
@gayanhewa
gayanhewa / config.xml
Created September 19, 2012 04:49
Magent extention : Working config.xml file with custom table
<config>
<modules>
<Sample_Socialmedia>
<version>0.0.1</version>
</Sample_Socialmedia>
</modules>
<frontend>
<routers>
<socailpromo>
<use>standard</use>

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
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
@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
<?php
class TestCase extends Illuminate\Foundation\Testing\TestCase {
/**
* Creates the application.
*
* @return Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
@gayanhewa
gayanhewa / sample
Created August 4, 2014 07:56
Spaces.
<?php
$status = 'Image successfully uploaded!';
?>
@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 / 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 / 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