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 / Auth.php
Created November 27, 2017 08:31
Auth bugs
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Auth extends Rest_Controller {
/**
* Device types allowed in app
*/
const DEVICE_TYPES = ['ios', 'android'];
@jagroop
jagroop / Database.php
Created November 27, 2017 10:37
insert or update if duplicate (Bulk)
public static function insertOrUpdate($table, array $rows)
{
$first = reset($rows);
$columns = implode(',', array_map(function($value)
{
return "$value";
}, array_keys($first)));
$values = implode(',', array_map(function($row)
<!-- PMA-SQL-ERROR -->
<div class="error"><h1>Error</h1>
<p><strong>SQL query:</strong>
<a href="tbl_sql.php?sql_query=SHOW+TABLE+STATUS+FROM+%60dawghoused%60+LIKE+%27dawghoused_bp_notifications%27&amp;show_query=1&amp;db=dawghoused&amp;table=dawghoused_bp_notifications&amp;token=8ec2db191e1e1dc37a8fc266da54e6eb"><span class="nowrap"><img src="themes/dot.gif" title="Edit" alt="Edit" class="icon ic_b_edit" /> Edit</span></a> </p>
<p>
<span class="syntax"><span class="inner_sql"><a href="./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.6%2Fen%2Fshow.html&amp;token=8ec2db191e1e1dc37a8fc266da54e6eb" target="mysql_doc"><span class="syntax_alpha syntax_alpha_reservedWord">SHOW</span></a> <span class="syntax_alpha syntax_alpha_reservedWord">TABLE</span> <span class="syntax_alpha syntax_alpha_reservedWord">STATUS</span> <span class="syntax_alpha syntax_alpha_reservedWord">FROM</span> <span class="syntax_quote syntax_quote_backtick">`dawghoused`</span> <a href="./url.php?url=http%3A%2F%2Fdev.mys
@jagroop
jagroop / multiple_ssh_setting.md
Created November 28, 2017 19:55 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@jagroop
jagroop / query.sql
Last active December 1, 2017 05:22
Query
select usr.id as user_id, first_name, last_name, bp.*, risk.* from test_type_verification as test
inner join `jbt_testeeUsers` as usr on test.user_id = usr.id
left join bp_a1c_risk_ques_2016 as bp on test.user_id = bp.user_id
left join risk_Assessment_questions_2016 as risk on test.user_id = risk.user_id
where usr.id = 133
@jagroop
jagroop / TournamentsController.php
Created December 5, 2017 19:44
Import Excel Laravel
<?php
namespace App\Http\Controllers\Admin\Tournaments;
use App\Http\Controllers\Controller;
use App\Models\Tournament;
use Excel;
use Illuminate\Http\Request;
use Validator;
@jagroop
jagroop / FCM_IOS.md
Last active December 13, 2017 05:03 — forked from rolinger/gist:d6500d65128db95f004041c2b636753a
PHP => FCM Push notification tutorial for Android and iOS

Below is a full tutorial on how to setup and use Googles Firebase push notification API for both Android and iOS. It is based on this earlier implementation of Googles GCM method: https://gist.github.com/prime31/5675017 - FCM is the new method and GCM will eventually be retired.

THE BELOW METHOD IS THE NEWER FCM METHOD:

Register your app in the FCM Console: https://console.firebase.google.com (add project)

  1. Click on the newly added project, in the upper left menu is the "Overview" and Gear Settings.
  2. Click on the GEAR settings icon, and then on "Project Settings"
  3. In the main screen, click on "Cloud Messaging"
sendMessageIos
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<input type="text" id="sample-text" value="Lorem ipsum dolor sit amet">
@jagroop
jagroop / ajax.php
Last active February 21, 2018 10:33
<?php
require 'init.php';
$done = false;
if(isset($_POST['username'], $_POST['userjob']))
{
$data = [
'name' => $_POST['username'],