Skip to content

Instantly share code, notes, and snippets.

View grim-reapper's full-sized avatar

Imran Ali grim-reapper

View GitHub Profile
@grim-reapper
grim-reapper / service-worker.js
Created January 25, 2022 13:02 — forked from JMPerez/service-worker.js
An example of a service worker for serving network first, cache second
// the cache version gets updated every time there is a new deployment
const CACHE_VERSION = 10;
const CURRENT_CACHE = `main-${CACHE_VERSION}`;
// these are the routes we are going to cache for offline support
const cacheFiles = ['/', '/about-me/', '/projects/', '/offline/'];
// on activation we clean up the previously registered service workers
self.addEventListener('activate', evt =>
evt.waitUntil(
@grim-reapper
grim-reapper / app.js
Created January 21, 2022 13:08 — forked from echr/app.js
Simple Laravel + Vue + Laravel Mix + Firebase Notification (PWA, Offline)
// FILE PATH: /resources/js/app.js
require('./bootstrap');
// Import Service Worker Registry
require('./extensions/sw-registry');
import Vue from 'vue';
...
SQL Server 2017
----------------
Enterprise Core - 6GPYM-VHN83-PHDM2-Q9T2R-KBV83
Developer - 22222-00000-00000-00000-00000
Enterprise - TDKQD-PKV44-PJT4N-TCJG2-3YJ6B
Standard - PHDV4-3VJWD-N7JVP-FGPKY-XBV89
Web - WV79P-7K6YG-T7QFN-M3WHF-37BXC
https://www.teamos-hkrg.com/index.php?threads/microsoft-sql-server-english-2017-rtm-teamos.42103/
@grim-reapper
grim-reapper / Functional_Functions.md
Created October 26, 2021 12:15 — forked from mfix22/Functional_Functions.md
Fun functional programming examples, without error handling

A bunch of random, contrived functions with maybe some value. Mostly small proof-of-concepts.

Examples

destructure()

Operates just like const sanitize = ({ id, email, date }) => ({ id, email, date }) but with destructure you can store your included keys in an array, say, in your config.

const keysToInclude = ['id', 'email', 'date']
const sanitize = destructure(keysToInclude)
@grim-reapper
grim-reapper / damerau–levenshtein-distance.php
Created October 6, 2021 12:41 — forked from gekh/damerau–levenshtein-distance.php
Damerau–Levenshtein distance [PHP]
<?php
/**
* Find Damerau–Levenshtein distance between two string
*
* @param string $source
* @param string $dest
* @return int Damerau–Levenshtein distance
*/
function distance($source, $dest)
@grim-reapper
grim-reapper / index.js
Created September 21, 2021 09:55 — forked from akexorcist/index.js
Axios post method requesting with x-www-form-urlencoded content type
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@grim-reapper
grim-reapper / http-redirect-target.php
Created September 13, 2021 19:35 — forked from hayd/http-redirect-target.php
Get HTTP redirect destination for a URL in PHP
<?php
// FOLLOW A SINGLE REDIRECT:
// This makes a single request and reads the "Location" header to determine the
// destination. It doesn't check if that location is valid or not.
function get_redirect_target($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
@grim-reapper
grim-reapper / XSS.php
Created August 12, 2021 09:45 — forked from cinkagan/XSS.php
Laravel Query String Xss Security Middleware
<?php
namespace App\Http\Middleware;
use Illuminate\Support\Facades\Redirect;
use Closure;
class XSS
{
/**
@grim-reapper
grim-reapper / background.js
Created August 11, 2021 04:59 — forked from olegp/background.js
Active tab change detection in Chrome Extension
let activeTabId, lastUrl, lastTitle;
function getTabInfo(tabId) {
chrome.tabs.get(tabId, function(tab) {
if(lastUrl != tab.url || lastTitle != tab.title)
console.log(lastUrl = tab.url, lastTitle = tab.title);
});
}
chrome.tabs.onActivated.addListener(function(activeInfo) {