Skip to content

Instantly share code, notes, and snippets.

View jack2jm's full-sized avatar

Jatin Mandanka jack2jm

View GitHub Profile
$(document).on('click', '.follow-action, .no-events-follow-action', function (ev) {
var fid="";var ftype="";var t= $(this); var btntext="Following";
if(logged){
try{
var fid =$(this).attr('data-id');
var ftype =$(this).attr('data-type');
}catch(e){}
if(fid!="" && ftype!=""){
if(ftype=="organizer"){
@jack2jm
jack2jm / inview-check-javascript-IntersectionObserver
Created May 28, 2019 09:29
This code can check view is in block or not - IntersectionObserver
var get_started_block = document.getElementById("get-started");
var float_button = document.getElementById("float-btn");
function handler(entries, observer) {
for (entry of entries) {
if (entry.isIntersecting) {
float_button.style.display = "none";
}else{
float_button.style.display = "block";
}
@jack2jm
jack2jm / gravatar_function.php
Created July 22, 2019 05:11 — forked from itsbalamurali/gravatar_function.php
Simple PHP Gravatar Function
<?php
/**
Load a gravatar.
*/
function gravatar($email = '', $rating = 'pg') {
$default = "path/to/defava.png"; // Set a Default Avatar
$email = md5(strtolower(trim($email)));
$gravurl = "http://www.gravatar.com/avatar/$email?d=$default&s=60&r=$rating";
return '<img src="'.$gravurl.'" width="60" height="60" border="0" alt="Avatar">';
@jack2jm
jack2jm / Newsletter image with shadow
Created October 9, 2019 05:01
Newsletter image with shadow
<td class="main-pad" style="box-sizing: border-box; line-height:1.5;-webkit-text-size-adjust:none !important;font-size:14px;font-family:verdana;font-family:verdana,arial,sans-serif;color:#333;padding:0px 40px 0 40px;">
<a href="https://allevents.in/mumbai/breakfast-cycle-ride/80002633040118?aff=u8zld&amp;utm_source=clevertap&amp;utm_medium=newsletter&amp;utm_campaign=ticketing-events&amp;utm_term=thingstodo&amp;utm_content=mumbaicity" target="_blank">
<img alt="Breakfast Cycle Ride" src="https://cdn-az.allevents.in/banners/7b9d54ffcab51c69a5520bddbaface47-rimg-w699-h233-dc1c4584-gmir.jpeg" style="box-sizing: border-box;width: 600px;max-height: 200px;width: 100%;display: block;background-color: #ffffff;color: #000000;border-radius: 10px;">
</a>
<img alt="" src="https://in.bmscdn.com/mailers/images/180207nm/banner_shadow.jpg" style="box-sizing: border-box; width: 100%; display: block; background-color: #ffffff; color: #000000;">
</td>
function sort_by_value($a, $b) {
return $b['score'] > $a['score'] ? 1 : -1;
}
//sort using usort
usort($events_temp, 'sort_by_value');
----------Edit cron job ---------------------
-> write comman "crontab -e"
-> press "i"
-> go to last cron job.
-> add new cron job
-> press ESC -> press ":wq"
----------- File Permission give ------------
*Give permission to .sh file*
*********
Open file path
--------------------
$myfile = fopen("data/finalized-ids.txt", "a+") or die("Unable to open file!");
Write something into file
--------------
fwrite($myfile, "event_ids,". PHP_EOL);
@jack2jm
jack2jm / gist:2a7f585a67efa5051bdda7ba09956de6
Last active October 2, 2020 10:44
Install NPM, PM2, Puppeteer
sudo apt-get update
sudo apt install curl
sudo apt install git-all
sudo apt-get install nodejs
sudo apt install npm
npm install (download all required)
----------
sudo npm install express
Clone tables
---------------
CREATE TABLE app_cities_temp LIKE app_cities;
INSERT INTO app_cities_temp SELECT * FROM app_cities;
List:
Using below command, you can display all the processes with status.
pm2 list
-----------------------------------------------
Stop:
To stop an application, you can use below command.