Skip to content

Instantly share code, notes, and snippets.

View scsskid's full-sized avatar
:octocat:

Benedikt Gregor scsskid

:octocat:
View GitHub Profile
@scsskid
scsskid / inline-svg-function.scss
Created September 1, 2021 15:37 — forked from JacobDB/inline-svg-function.scss
Inline SVG function [SASS]
// Replace letters
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
@scsskid
scsskid / README.md
Last active September 1, 2021 15:28 — forked from sutlxwhx/README.md
How to backup your LAMP / LEMP installation the right way #bash #ubuntu

Introduction

This is the LAMP / LEMP environment backup guide in case you want or need to try my highload LEMP installation.

Basic usage

As a first thing we will setup a variable that will store current date and time. We will use year-month-day_hours-minutes-seconds format:

now=$(date +"%Y-%m-%d_%H-%M-%S")
@scsskid
scsskid / serviceworker.js
Created December 10, 2020 11:01 — forked from kosamari/serviceworker.js
cache index.html using Service Worker
/*
* CHALLANGE:
* Cache `index.html` file using service worker.
*
* This bit of code is included in <script> tag of index.html
* if (navigator.serviceWorker) {
* navigator.serviceWorker.register('serviceworker.js', {scope: '/'})
* }
*
*/
@scsskid
scsskid / server.js
Created December 9, 2020 15:13 — forked from bencentra/server.js
An HTTPS server for static content (Node.js)
/*
This module creates an HTTPS web server and serves static content
from a specified directory on a specified port.
To generate a new cert:
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
To remove the passphrase requirement:
@scsskid
scsskid / date-object-cheatsheet.js
Last active September 1, 2021 15:34 — forked from LeCoupa/date-object-cheatsheet.js
JavaScript Date Object CheatSheet | #date
// src: https://github.com/LeCoupa/awesome-cheatsheets
// Date Object CheatSheet
// The Date object is used to work with dates and times.
// More: http://www.w3schools.com/jsref/jsref_obj_date.asp
// 1. Instantiating a Date.
@scsskid
scsskid / Common-Currency.json
Created November 16, 2020 18:26 — forked from ksafranski/Common-Currency.json
[Common Currency Codes] in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@scsskid
scsskid / _headers
Created September 19, 2020 16:57 — forked from robsonsobral/_headers
Netlify headers
/*
# Only connect to this site and subdomains via HTTPS for the next one year
Strict-Transport-Security: max-age=31536000; includeSubDomains
# Block site from being framed with X-Frame-Options and CSP
Content-Security-Policy: frame-ancestors 'self'
# X-Frame-Options tells the browser whether you want to allow your site to be framed or not. By preventing a browser from framing your site you can defend against attacks like clickjacking.
X-Frame-Options: SAMEORIGIN
@scsskid
scsskid / introrx.md
Created July 7, 2020 09:46 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@scsskid
scsskid / .htaccess
Created February 27, 2020 17:57 — forked from davemackintosh/.htaccess
Working .htaccess for Single Page Apps
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.html [QSA,L]
</ifModule>
@scsskid
scsskid / README.md
Last active July 29, 2020 07:46 — forked from chuckreynolds/wordpress-change-domain-migration.sql
Wordpress Change Domain SQL Commands

Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: always backup your database. __STEP2: change the ‘oldsite.com’ and ‘newsite.com’ variables to your own. _STEP3: make sure your database prefix is “wp”, if it’s not then you’ll want to go through and change the prefix in each line to whatever yours is. __STEP4: copy the modified variables and the queries and paste it into phpMyAdmin or, better yet, SequelPro and run it on your database. TEST. DONE. __Changelog: — updated queries to use variables instead of editing the urls in many different areas — commented out GUID and left as optional. shouldn’t reset those. ref: codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note