Skip to content

Instantly share code, notes, and snippets.

View nakulrathore's full-sized avatar
🤸‍♂️
memeing

Narendra Singh nakulrathore

🤸‍♂️
memeing
View GitHub Profile
@nakulrathore
nakulrathore / namaste.gif
Last active April 13, 2019 16:09
Namaste
namaste.gif
@nakulrathore
nakulrathore / minimal_reset.css
Created January 17, 2019 10:44
css minimal reset
html {
box-sizing: border-box;
font-size: 16px;
}
*, *:before, *:after {
box-sizing: inherit;
}
body, h1, h2, h3, h4, h5, h6, p, ol, ul {
@nakulrathore
nakulrathore / mixins.scss
Created December 28, 2018 06:21
Sass Media Queries
// mixins for responsiveness
@mixin media-breakpoint-up($screen-type) {
@if $screen-type == xxs {
@media(min-width: 399.98px) {
@content;
}
}
@if $screen-type == xs {
@media(min-width: 575.98px) {
@nakulrathore
nakulrathore / ERROR.js
Created June 2, 2018 23:22 — forked from McKabue/ERROR.js
Handling JavaScript Errors Like a boss by logging them to the server and possibly returning a behavior. WE THEN MAKE A REQUEST TO YOUR SERVERS AS IF YOU ARE LOADING A JAVASCRIPT FILE. THE URL WILL CONTAIN THE QUERY PARAMETERS THAT YOU WANT TO PASS TWO THE SERVER. THIS METHOD HAS TO ADVANTAGES: 1. THE CODE FOR SENDING THE REQUEST IS SIMPLE AS WE …
//https://developer.mozilla.org/en/docs/Web/API/GlobalEventHandlers/onerror
//https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror.html
//https://danlimerick.wordpress.com/2014/01/18/how-to-catch-javascript-errors-with-window-onerror-even-on-chrome-and-firefox/
window.onerror = function (messageOrEvent, source, lineno, colno, error) {
try {
console.log({
//error message(string).Available as event (sic!) in HTML onerror = "" handler.
messageOrEvent: messageOrEvent,
//URL of the script where the error was raised(string)
@nakulrathore
nakulrathore / isOnline.js
Created August 18, 2017 15:01
Detect Browser Online/offline status
function updateOnlineStatus()
{
console.log('online');
}
function updateOfflineStatus()
{
console.log('offline')
}
@nakulrathore
nakulrathore / twitter_heart_animation
Created June 19, 2017 13:58
Twitter heart Animation pure css
<head>
<style>
.heart {
width: 100px;
height: 100px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: url(https://raw.githubusercontent.com/nakulrathore/materialcolors/gh-pages/heart.png) no-repeat;
@nakulrathore
nakulrathore / slack_webhook.php
Created June 14, 2017 14:31
Slack Incoming Web-hook via PHP
<?php
function slack($message, $room, $icon) {
$room = ($room) ? $room : "defoult_room";
$data = "payload=" . json_encode(array(
"channel" => "$room",
"username" => "Name your Bot",
"text" => $message,
"icon_emoji" => $icon