Skip to content

Instantly share code, notes, and snippets.

View DilwoarH's full-sized avatar
👨‍💻
Coding

Dilwoar Hussain DilwoarH

👨‍💻
Coding
View GitHub Profile
@DilwoarH
DilwoarH / sectors_csv_generator.js
Created September 26, 2019 09:37
sectors_csv_generator.js
var csv = [["Sector heading", "Section name"]];
$('.gem-c-checkboxes.govuk-form-group').each(function(index, section){
var sector_heading = $(section).find("legend").text();
$(section).find('ul li').each(function(index, sector){
var sector_name = $(sector).find('label').text();
csv.push([sector_heading, sector_name]);
});
})
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule ^/(.*) https://www.example.com/$1 [L,R]
ServerAdmin webmaster@example.com
DocumentRoot /var/www/example.com
<Directory "/var/www/example.com">
Options Indexes FollowSymLinks
<VirtualHost *:80>
ServerAdmin webmaster@example.com
Redirect 301 / https://www.example.com
DocumentRoot /var/www/example.com
</VirtualHost>
# Lets Encrypt - https://certbot.eff.org/lets-encrypt/ubuntubionic-apache
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot python-certbot-apache -y
sudo certbot certonly --apache
# enable ssl
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@edusensys.com
Redirect 301 / https://www.example.com
DocumentRoot /var/www/example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule ^/(.*) https://www.example.com/$1 [L,R]
@DilwoarH
DilwoarH / mocha_test.js
Created December 6, 2019 11:56
Template for mocha test
const Mocha = require("mocha");
const assert = require("assert");
const mocha = new Mocha();
describe("Something", () => {
it("does something", () => {
assert.equal(1, 1);
});
{
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36",
"benchmarkIndex": 1281
},
"lighthouseVersion": "5.7.0",
"fetchTime": "2020-04-28T11:07:26.066Z",
"requestedUrl": "https://www.islamiclandmarks.com/",
@DilwoarH
DilwoarH / Prayer times App script.js
Last active July 23, 2021 21:19
Prayer times App script
function doGet(e){
if (!e.parameter["google_sheet_id"]) {
var error = JSON.stringify({
"error": "google_sheet_id parameter is required"
});
return ContentService.createTextOutput(error).setMimeType(ContentService.MimeType.JSON);
}
// Change Spread Sheet url
{
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4143.7 Mobile Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36",
"benchmarkIndex": 1137,
"credits": {
"axe-core": "3.5.5"
}
},
@DilwoarH
DilwoarH / LaravelBuild.sh
Last active October 3, 2021 10:55
LaravelBuild.sh
docker info > /dev/null 2>&1
# Ensure that Docker is running...
if [ $? -ne 0 ]; then
echo "Docker is not running."
exit 1
fi
docker run --rm \