Skip to content

Instantly share code, notes, and snippets.

View MubinSayed's full-sized avatar
🎯
Focusing

Mubin Sayed MubinSayed

🎯
Focusing
View GitHub Profile
@powerexploit
powerexploit / wikipy.py
Created September 24, 2019 14:43
Wikipedia scraping with python
#!/usr/bin/python3
#Scraping wikipedia page according to your command line input
import sys
import requests
import bs4
RED = '\033[31m'
END = '\033[0m'
ascii_art = RED \
+ """
@MubinSayed
MubinSayed / CourseController.php
Last active April 25, 2021 05:11
Laravel Datatable Dynamic Filter (Advance Filter) (phpMyAdmin Style)
<?php
namespace App\Http\Controllers;
use DB;
use Config;
use App\Models\Course;
use Illuminate\Http\Request;
use Yajra\Datatables\Datatables;
use Illuminate\Support\Facades\Validator;
@MubinSayed
MubinSayed / indexed.php
Last active September 25, 2018 03:39
php arrays
<?php
// indexed array examples
$list = array( 'mango', 'apple', 'grape', 'orange' );
// or
$list = [ 'mango', 'apple', 'grape', 'orange' ];
//or
$list = array();
@lancejpollard
lancejpollard / encryption.js
Created December 14, 2017 03:59 — forked from vlucas/encryption.js
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bytes (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv);
@meigwilym
meigwilym / console.php
Last active March 5, 2024 02:20
Laravel Create User Command
<?php
// routes/console.php
// quickly create an user via the command line
Artisan::command('user:create', function () {
$name = $this->ask('Name?');
$email = $this->ask('Email?');
$pwd = $this->ask('Password?');
// $pwd = $this->secret('Password?'); // or use secret() to hide the password being inputted
\DB::table('users')->insert([
@dyazincahya
dyazincahya / Record_activity.php
Last active June 11, 2019 11:40
Library record activity for codeigniter
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|
| Library for record all activity
| K4ng
|
*/
@dertajora
dertajora / save_to_csv.php
Last active May 7, 2021 00:38
This script is used to generate CSV file and save it to specific folder, I implement it on Codeigniter. Please modify the location of APPPATH section if you want to save to another location
<?php
// this script would save csv file to this specified directory
// APPPATH is location of application folder in Codeigniter
$file = fopen(APPPATH . '/../upload/'.'tesaasasat.csv', 'wb');
// set the column headers
fputcsv($file, array('Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5'));
// Sample data. This can be fetched from mysql too
$data = array(
@sworup
sworup / laravel-validation-error.js
Last active July 9, 2021 13:04
Handling of Laravel validation message when pulled through Ajax request
error: function (request) {
// Validation error would return 422 header
if (request.status == 422) {
// Parser the json response expected
var $errors = $.parseJSON(request.responseText);
// Bootstrap alert scafolding for error
var errorsHtml = '<div class="alert alert-danger alert-dismissible"><button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button><h4><i class="icon fa fa-times"></i>Opps! Seems like you didn\'t fill the form properly...</h4><ul>';
// The root nodes are field names, with an array of error messages
$.each( $errors, function( key, value ) {
// We loop through the error to see if there are multiple error associated with the field
@wei
wei / fullbackup.php
Created June 2, 2015 22:15
CPanel Full Backup Cron Script
<?php
// PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server.
// Cron Job Command: /usr/local/bin/php /home/<cpanel-username>/fullbackup.php
// This script contains passwords. It is important to keep access to this file secure (we would ask you to place it in your home directory, not public_html)
// You need create 'backups' folder in your home directory ( or any other folder that you would like to store your backups in ).
// ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED *********
@dennysfredericci
dennysfredericci / search-ul-li-item.js
Created July 22, 2014 18:19
A simple jquery code to search a text inside of li tag
//searchText is a input type text
$('#searchText').bind('keyup', function() {
var searchString = $(this).val();
$("ul li").each(function(index, value) {
currentName = $(value).text()
if( currentName.toUpperCase().indexOf(searchString.toUpperCase()) > -1) {