Skip to content

Instantly share code, notes, and snippets.

👨‍💻
At Office

Jagroop Singh jagroop

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

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 Dec 13, 2017
Delete git history
View blog.md
#!/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 Aug 25, 2017
PHP Multi curl to check if domains are indexed in google
View script.php
<?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);
View create.blade.php
@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 Sep 19, 2017
Stripe Library
View Stripe.php
<?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 Oct 24, 2017
Setup FTP on LAN Computer
View vsftpd.sh
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 Nov 17, 2017
Cron jobs Logics
View _3_30_am.php
<?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 Nov 21, 2017
Method Overriding Advance Example
View Request.php
<?php
class Request
{
public static function __callStatic($method, $args)
{
return RequestHandler::new()->{$method}(...$args);
}
}
class RequestHandler {
@jagroop
jagroop / App_name.desktop
Last active Nov 24, 2017
Creating a working .desktop file
View App_name.desktop
[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 Nov 27, 2017
Controller Issues | Bad Formatting
View User.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use Carbon\Carbon;
class User extends Rest_Controller {
/**
* Uploads Path
*/
const UPLOADS = FCPATH . 'uploads/';
You can’t perform that action at this time.