Skip to content

Instantly share code, notes, and snippets.

🚀
Available for Hire!

Yoosuf yoosuf

🚀
Available for Hire!
Block or report user

Report or block yoosuf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yoosuf
yoosuf / stopnremoveall.sh
Created Aug 14, 2019
Stop and remove all docker containers and images (Docker)
View stopnremoveall.sh
# List all containers (only IDs)
docker ps -aq
# Stop all running containers
docker stop $(docker ps -aq)
# Remove all containers
docker rm $(docker ps -aq)
# Remove all images
@yoosuf
yoosuf / anagram.rb
Created Oct 31, 2018
Simple Anagram with Ruby
View anagram.rb
def anagram(str1, str2)
if str1.nil? || str2.nil? || str1.empty? || str2.empty?
return false
end
demo1 = str1.split("").sort
demo2 = str2.split("").sort
test1 = noirmalise(demo1)
test2 = noirmalise(demo2)
View keybas.md

Keybase proof

I hereby claim:

  • I am yoosuf on github.
  • I am yoosuf (https://keybase.io/yoosuf) on keybase.
  • I have a public key ASC_dKx0ccA1QlANU9Yw__6uEIvFZV6WCE3eFhMPBsRs3go

To claim this, I am signing this object:

View react-route-4-layout.js
import React, { Component } from 'react';
import { BrowserRouter as Router, Route } from 'react-router-dom'
import Layout from './components/layout/Layout'
import Home from './components/Home'
import Explore from './components/Explore'
import Profile from './components/Profile'
@yoosuf
yoosuf / DailyBackupAndSync.php
Created Jan 5, 2017
Daily backup and Restore Laravel Command
View DailyBackupAndSync.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
class DailyBackupAndSyncCommand extends Command
{
/**
@yoosuf
yoosuf / datadump.sql
Created Nov 7, 2016
Member::whereJsonContains()
View datadump.sql
INSERT INTO `members` (`id`, `name`, `msisdn`, `token`, `api_token`, `settings`, `created_at`, `updated_at`)
VALUES
(1, NULL, '343434343434', '303273', 'GIUalPNIiiBIiQsBeJDeeMvxhgL9wrDOrlE5AqGyZvHFWwPuuBPjHziTWZHu2xuM', '{\"topics\":[\"topic1\",\"topic2\"]}', '2016-11-05 07:56:55', '2016-11-05 07:56:55'),
(2, 'Haiooo', '0776002114', '150093', '5peAwwfkYo19sRQTZq21ePMynJrRlTLuTwvxGVoSvLIz4jRVQ830nnflZGv9cUK3', '{\"topics\":[\"topic1\",\"topic2\",\"topic3\",\"topic4\"]}', '2016-11-06 02:27:31', '2016-11-06 02:27:53');
@yoosuf
yoosuf / active.blade.php
Created May 5, 2016
Setting Bootstrap navbar active class in Laravel 5
View active.blade.php
<ul class="nav nav-second-level">
<li class="{{ Request::segment(1) === 'programs' ? 'active' : null }}">
<a href="{{ url('programs' )}}" ></i> Programs</a>
</li>
<li class="{{ Request::segment(1) === 'beneficiaries' ? 'active' : null }}">
<a href="{{url('beneficiaries')}}"> Beneficiaries</a>
</li>
<li class="{{ Request::segment(1) === 'indicators' ? 'active' : null }}">
<a href="{{url('indicators')}}"> Indicators</a>
</li>
@yoosuf
yoosuf / tands.php
Last active Mar 27, 2016
Managing everything is WordPress is messy, so I wanted to send a POST request when a post is published
View tands.php
<?php
/**
* @package tands
* @version 0.1
*/
/*
Plugin Name: Trigger and Shoot by Yoosuf
Plugin URI: https://github.com/yoosuf
Description: This plugin simply pass the post details to where ever you want for what ever the porpose.
Author: Yoosuf Muhammad
@yoosuf
yoosuf / transaction.php
Last active Jul 11, 2017
WordPress: When a post is published, trigger an event
View transaction.php
<?php
/*
* Add this function somewhere in functions.php
* You will see there is nothing is magic in WordPress
**/
function on_all_status_transitions( $new_status, $old_status, $post ) {
if ('publish' == $new_status && 'publish' != $old_status && 'trash' != $old_status) {
// Your code comes here
@yoosuf
yoosuf / lk-vehicle-registration-validation.php
Last active Jan 27, 2016
Sri Lanka Vehicle Registration Validation - PHP
View lk-vehicle-registration-validation.php
<?php
function is_plate_valid($number)
{
// normal plate
if (preg_match("/([A-Z]{2,4}|\d{2,3}|[A-Z]{2} [A-Z]{2})[\-\]|[ ]\d{4}/", $number)) {
return true;
}
You can’t perform that action at this time.