Skip to content

Instantly share code, notes, and snippets.

@l2zeo
l2zeo / index.html
Created July 22, 2019 13:28 — forked from CodeBrauer/index.html
Style visited links with localStorage
<div class="wrap">
<h1>Style visited links with localStorage</h1>
<h2>Why?</h2>
<p>
Since browsers allow only very basic CSS on <code>:visited</code> I created this way to check a user has clicked a link. If he clicks on any link, that has the class <code>.trackVisit</code> the complete href is saved in an array in localStorage.
On each page visit and click on a link the script adds the class <code>.visited</code> so we can style it however we want.
</p>
<h2>Demo Links: Repo services</h2>
<p>
The links have <code>e.preventDefault();</code> - so you can click them hassle free ;)
@1hakr
1hakr / example.com
Last active November 29, 2024 20:48
Supercharge your NGIX config
proxy_cache_path /tmp/cacheapi levels=1:2 keys_zone=microcacheapi:100m max_size=1g inactive=1d use_temp_path=off;
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com;
location /api/ {
# Rate Limiting
limit_req zone=reqlimit burst=20; # Max burst of request
@cweinberger
cweinberger / mysql-drop-all-tables.sh
Created June 6, 2018 12:44
drops all tables of a specific db
#!/bin/bash
#usage: mysql-drop-all-tables -d database -u dbuser -p dbpass
TEMP_FILE_PATH='./drop_all_tables.sql'
while getopts d:u:p: option
do
case "${option}"
in
@jmatamatics
jmatamatics / Selenium
Created December 2, 2017 23:59
Scraping Instagram for hastags
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import csv
@CodeBrauer
CodeBrauer / index.html
Created November 9, 2016 11:19 — forked from anonymous/index.html
Style visited links with localStorage
<div class="wrap">
<h1>Style visited links with localStorage</h1>
<h2>Why?</h2>
<p>
Since browsers allow only very basic CSS on <code>:visited</code> I created this way to check a user has clicked a link. If he clicks on any link, that has the class <code>.trackVisit</code> the complete href is saved in an array in localStorage.
On each page visit and click on a link the script adds the class <code>.visited</code> so we can style it however we want.
</p>
<h2>Demo Links: Repo services</h2>
<p>
The links have <code>e.preventDefault();</code> - so you can click them hassle free ;)
@kijin
kijin / fixcloudflare.php
Last active January 21, 2023 14:51
CloudFlare 사용시 실제 방문자 IP 및 SSL 사용 여부 파악
<?php
/**
* CloudFlare 사용시 실제 방문자 IPSSL 사용 여부를
* 정확하게 파악하지 못하는 문제를 해결하는 클래스
* 웹서버에 mod_cloudflare를 설치하기 곤란한 경우 사용한다
*
* Written by 기진곰 <kijin@kijinsung.com>
* License: Public Domain
*
@mayeenulislam
mayeenulislam / enable-lazyload-js
Last active December 8, 2016 02:00
This is a code to enable jQuery LazyLoad into any DOM. It was made according to the guideline (http://www.appelsiini.net/projects/lazyload) and based on the last update on this github repo (https://github.com/tuupola/jquery_lazyload). It is just the basic, you are free doing your tweaks.
jQuery(document).ready(function($) {
var imgs = $('img'); //grabbing all the images of a DOM
imgs.addClass('lazy'); //adding .lazy to all the images
imgs.each(function() {
var img_src = $(this).attr('src'); //grabbing the 'src=""' value of each of the img
$(this).attr('data-original', img_src); //assigning the src value to 'data-original'
$(this).removeAttr('src'); //now deleting the 'src' attribute
});
@johnchambers
johnchambers / cookie_note.css
Last active December 8, 2016 04:39
Cookie Policy
@achingono
achingono / ToggleCss.html
Created November 26, 2013 16:52
Dynamically Enable/Disable CSS files
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title></title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/Content/Design.css">
<link rel="stylesheet" href="/Content/Print.css" disabled="disabled">
<link rel="stylesheet" href="/Content/Large.css" disabled="disabled">
</head>