Skip to content

Instantly share code, notes, and snippets.

👨‍💻
At Office

Jagroop Singh jagroop

👨‍💻
At Office
Block or report user

Report or block jagroop

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
@jagroop
jagroop / parse_string.php
Last active Mar 1, 2018
PHP Parse string and Limit Characters
View parse_string.php
<?php
function parseString($text, $limit = 100, $end = '')
{
$text = preg_replace("/[\r\n]+/", "\n", $text);
$value = stripslashes(preg_replace("/\s+/", ' ', $text));
if (mb_strlen($value) <= $limit) {
return $value;
}
return rtrim(mb_substr($value, 0, $limit, 'UTF-8')) . $end;
View index.php
<?php
require 'vendor/autoload.php';
require 'helpers.php';
$randomTxt = "jagroop singh.";
$redeemdesc = 'Reward entitles you to one night of Romance with Giver. Giver will take all necessary steps to create the mood and conditions to spark the';
$redeemPoint = '750';
$title = 'Reward title';
$firstReply = parseString($randomTxt);
$from = 'jagroop';
View default_helper.php
if (!function_exists('carbon')) {
function carbon(...$args) {
return new Carbon\Carbon(...$args);
}
}
@jagroop
jagroop / test.php
Created Mar 7, 2018
sleep time check
View test.php
public function carbonTest()
{
$tz = 'UTC';
$asia = 'Asia/Calcutta';
date_default_timezone_set($tz);
// $currentTime = carbon()->now()->tz($asia)->format('H:i:s');
$currentTime = '21:01:00';
View Jquery_validation.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Jquery_validation {
private $rules; // json rules for jQuery validator
private $messages; // custom error messages for jQuery validator
private $js_rules = array( 'required' => 'required',
'matches' => 'equalTo',
'min_length' => 'minlength',
'max_length' => 'maxlength',
'greater_than' => 'min',
View LanguageLoader.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class LanguageLoader {
public function initialize() {
$ci =& get_instance();
$ci->load->helper('language');
$siteLang = $ci->session->userdata('site_lang');
if ($siteLang) {
@jagroop
jagroop / moment_js.html
Last active Mar 19, 2018
Moment.js Date Time Localization
View moment_js.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Testing moment Js</title>
</head>
<body>
<table border="1" class="table table-hover" id="myTable">
<thead>
<tr>
View test.html
<html>
<head>
<title>PaintBrush Application Demo</title>
<style type="text/css">
h1 {
font-size: 20px;
font-weight: bold;
}
View links.txt
View sdf
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["id"]. "</td>
<td>" . $row["name"]."</td>
<td>" . $row["email"]. "</td>
<td><a href='edit.php?id=". $row["id"] ."'> <button class='btn'>Edit</button></a> <br><br>
<a href='formd?id=".$row["id"]."'> <button id='delete-btn' data-user_id='".$row["id"]."''>Delete </button> </a>
</td>
</tr>";
}
echo "</table>";
You can’t perform that action at this time.