Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View amitmerchant1990's full-sized avatar

Amit Merchant amitmerchant1990

View GitHub Profile
@amitmerchant1990
amitmerchant1990 / style.scss
Created January 2, 2022 13:46
Snowfall animation on amitmerchant.com
.site-avatar {
/* Christmas snow 🌨 */
&::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
@amitmerchant1990
amitmerchant1990 / konami.js
Created July 8, 2020 16:50
Konami Code Trigger
var pattern = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a'];
var current = 0;
var keyHandler = function (event) {
// If the key isn't in the pattern, or isn't the current key in the pattern, reset
if (pattern.indexOf(event.key) < 0 || event.key !== pattern[current]) {
current = 0;
return;
}
@amitmerchant1990
amitmerchant1990 / stylish.css
Last active March 26, 2021 02:21
Revert back to good old GitHub Homepage
/**
1. Install the Stylish(https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en) extension for Chrome.
2. Open up extension options and paste the CSS mentioned below.
3. Specify the "URLs on the domain" to be `github.com`.
4. Add a title and save.
*/
.dashboard-sidebar {
float: right;
padding-right: 10px;
@amitmerchant1990
amitmerchant1990 / index.php
Created February 3, 2018 07:00
Validate Email (PHP)
<?php
if(!filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) {
//Email is invalid. Show the user an error message.
}
@amitmerchant1990
amitmerchant1990 / instruction.md
Created November 16, 2017 05:07
Kill a node app

Assuming you are using linux If you need to stop some application running on some specific port use this and you know the port but not the process id. find the process id like this

netstat -plten | grep LISTEN | grep 3000

this will output some thing like this

tcp        0      0 :::10060                    :::*                          LISTEN      0          20465      3489/node    
where 3489 is the process id.
@amitmerchant1990
amitmerchant1990 / find_duplicate_records.sql
Created May 31, 2017 07:21
Quickly find duplicate records based on any field
SELECT *
FROM 2009_product_catalog
WHERE sku IN (
SELECT sku
FROM 2009_product_catalog
GROUP BY sku
HAVING count(sku) > 1
)
ORDER BY sku
@amitmerchant1990
amitmerchant1990 / remote_file_exists.php
Last active May 31, 2017 07:21
PHP : Check it remote file exists
<?php
// E.g. checkRemoteFileExists('https://avatars0.githubusercontent.com/u/3647841?v=3&s=460') == true
function checkRemoteFileExists($url){
$curl = curl_init($url);
//don't fetch the actual page, you only want to check the connection is ok
curl_setopt($curl, CURLOPT_NOBODY, true);
//do request
.
+-- hooks
+-- node_modules
+-- plugins
+-- resources
| +-- android
| +-- ios
| +-- wp8
+-- src
| +-- app
import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';
import { NavController } from 'ionic-angular';
import marked from 'marked';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})