Skip to content

Instantly share code, notes, and snippets.

View ahmedash95's full-sized avatar

Ahmed Ammar ahmedash95

View GitHub Profile
@ahmedash95
ahmedash95 / TwitterFeed.php
Created June 3, 2017 23:57
Mastring create Laravel Packages
<?php
class TwitterFeed {
private $consumerKey;
private $consumerSecret;
private $accessToken;
private $accessSecret
public function __constrcut($config){
<?php
return [
'consumer_key' => env('Twitter_Consumer_Key'),
'consumer_secret' => env('Twitter_Consumer_Secret'),
'access_token' => env('Twitter_Access_Token'),
'access_secret' => env('Twitter_Access_Secret'),
];
start=2013-09-05
end=2013-09-11
while [[ $start < $end ]]
do
printf "$start\n"; start=$(date -d "$start + 1 day" +"%Y-%m-%d")
done
<?php
interface Logger {
public function log(string $msg);
}
class Application {
private $logger;
public function getLogger(): Logger {
function sum(arrayOfIntegers){
return arrayOfIntegers.reduce((a, b) => a + b, 0);
}
// Example
var integers = [1,2,3,4,5);
sum(integers)
// Result
// 15
class Node(object):
def __init__(self, data, prev, next):
self.data = data
self.prev = prev
self.next = next
class DoubleList(object):
head = None
@ahmedash95
ahmedash95 / Posts.php
Last active October 23, 2017 14:37
PHP : Tight Coupled Example
<?php
class Posts {
private $commentsModel;
private $postsModel;
public function __construct(){
$this->commentsModel = new \App\Models\CommentsModel;
$this->postsModel = new \App\Models\PostsModel;
@ahmedash95
ahmedash95 / Loosely_Coupled.php
Created October 23, 2017 14:43
PHP : Loosely Coupled Example
<?php
Interface IPosts{}
Interface IComments{}
# Models
Class CommentsMysqlModel implements IComments{}
Class CommentsMongoDBModel implements IComments{}
Class PostsMysqlModel implements IPosts{}
@ahmedash95
ahmedash95 / golang-nuts.go
Created November 27, 2017 18:37 — forked from ryanfitz/golang-nuts.go
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
@ahmedash95
ahmedash95 / README.MD
Last active December 14, 2017 01:02
PluralSight courses sorter

PluralSight sorter

This script will help you to sort videos just use it as below and let him deal with it ;)

$ python ps-sorter.py "/path/to/course-directory"