Skip to content

Instantly share code, notes, and snippets.

View jagroop's full-sized avatar
👨‍💻
At Office

Jagroop Singh jagroop

👨‍💻
At Office
View GitHub Profile
@jagroop
jagroop / blog.md
Last active August 5, 2017 11:44
My Sublime text configuration

Sublime text configuration

{
	"bold_folder_labels": true,
	"caret_extra_bottom": 2,
	"caret_extra_top": 2,
	"caret_extra_width": 3,
	"caret_style": "phase",
	"close_windows_when_empty": true,
@jagroop
jagroop / blog.md
Last active December 13, 2017 17:51
Delete git history
#!/bin/bash

git checkout --orphan latest_branch # Checkout
git add -A # Add all the files
git commit -am "first commit" # Commit the changes
git branch -D master # Delete the branch
git branch -m master # Rename the current branch to master
git push -f origin master # Finally, force update your repository
@jagroop
jagroop / script.php
Created August 25, 2017 14:25
PHP Multi curl to check if domains are indexed in google
<?php
function multiRequest($data, $options = array()) {
$curly = array();
$result = array();
$mh = curl_multi_init();
foreach ($data as $id => $d) {
$url = 'http://webcache.googleusercontent.com/search?q=cache:' . urlencode($d);
$curly[$id] = curl_init($url);
curl_setopt($curly[$id], CURLOPT_RETURNTRANSFER, false);
curl_setopt($curly[$id], CURLOPT_FOLLOWLOCATION, false);
@jagroop
jagroop / create.blade.php
Created September 18, 2017 08:33
Sample
@extends('layouts.admin.main')
@section('content')
<div class="row">
<div class="col-md-12">
<!-- Domain Search form starts -->
<form class="form-horizontal" method="GET" action="{{ route('projects.create') }}" id="projectForm">
<div class="form-group{{ $errors->has('domain_name') ? ' has-error' : '' }}">
<label for="domain_name" class="col-md-4 control-label">Project Name</label>
@jagroop
jagroop / Stripe.php
Created September 19, 2017 09:30
Stripe Library
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use Carbon\Carbon;
class Stripe {
/**
* Default Platform Country
* @var string
*/
@jagroop
jagroop / vsftpd.sh
Created October 24, 2017 05:42
Setup FTP on LAN Computer
sudo -s
sudo apt-get update
sudo apt-get install vsftpd
useradd -d /var/www/html/projects/ jagroop-pc
paswd jagroop-pc
# Configuration
write_enable=YES
pam_service_name=ftp
@jagroop
jagroop / _3_30_am.php
Last active November 17, 2017 09:41
Cron jobs Logics
<?php
// 3:30 AM Cron job
public function threeAMCron()
{
$this->db->where_in('id', [14, 60]);
$this->db->where("date_format(CONVERT_TZ(NOW(), 'UTC', local_tz), '%H:%i') = '15:30'");
$users = $this->db->get('users')->result();
$this->load->library('notification');
foreach ($users as $key => $user) {
$this->notification->send($user, [
@jagroop
jagroop / Request.php
Last active November 21, 2017 05:13
Method Overriding Advance Example
<?php
class Request
{
public static function __callStatic($method, $args)
{
return RequestHandler::new()->{$method}(...$args);
}
}
class RequestHandler {
@jagroop
jagroop / App_name.desktop
Last active November 24, 2017 05:45
Creating a working .desktop file
[Desktop Entry]
Version=1.0
Name=Firefox
Comment=Launch Firefox
Exec=/home/jagroop/firefox/./firefox
Icon=/home/jagroop/firefox/browser/icons/mozicon128.png
Terminal=false
Type=Application
Categories=Internet;Application;
@jagroop
jagroop / User.php
Created November 27, 2017 06:21
Controller Issues | Bad Formatting
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use Carbon\Carbon;
class User extends Rest_Controller {
/**
* Uploads Path
*/
const UPLOADS = FCPATH . 'uploads/';