Skip to content

Instantly share code, notes, and snippets.

View borisdiakur's full-sized avatar
🍵
♬♫♪◖(- ᵕ -)◗ノ ♪♫♬

Boris Diakur borisdiakur

🍵
♬♫♪◖(- ᵕ -)◗ノ ♪♫♬
View GitHub Profile
@anthonydillon
anthonydillon / I_don't_care_about_cookies.css
Last active March 3, 2024 12:04
I don't care about cookies CSS selectors
html.cookie-notification-active, html.consent-bar-push-large, body.consent-bar-push-large, body.cookiepush, body.with-eu-cookie-guideline, body.gh-cookieb-active #gh.gh-cookieb-active, html.npo_cookieBar body, body.cookiewall, body.cookie-guard, body.with-cookie-hint, body.with-cookie-bar, html.has-cookie-bar, body.with-cookie-hint {margin-top:0 !important}
#cookiesPanel ~ #header, #CpHTMLCookieBar_siteWrapper, body.show-cookie-policy-info {top:0 !important}
body.needsCookieAcceptance, body.cookie-not-set, body.cookie_privacy_info, html.cookie body, body.has-cookie-banner, html.dj_gecko body[style], body.with-cookie-alert, body.body--is-alerted, body.ct-ultimate-gdpr-cookie-topPanel-padding {padding-top:0 !important}
html.with-cookie-hint, body.gh-cookieb-active #gh-gb.gh-cookieb-active {border-top:0 !important}
html.with-cookie-popup, html.with-cookie-popup body, body.page_cookieconfirmation, body.cookieoverlay-is-open, body.cookiewall-active, body.qc-cmp-ui-showing, body.freezePage {overflow:visible !import
@theodorosploumis
theodorosploumis / Nework_throttling_profiles.md
Last active May 31, 2024 14:45
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
@PierfrancescoSoffritti
PierfrancescoSoffritti / eventBus.js
Last active February 15, 2024 14:16
A simple implementation of an event bus in Javascript. More details here: https://medium.com/@soffritti.pierfrancesco/create-a-simple-event-bus-in-javascript-8aa0370b3969
/**
* subscriptions data format:
* { eventType: { id: callback } }
*/
const subscriptions = { }
const getNextUniqueId = getIdGenerator()
function subscribe(eventType, callback) {
const id = getNextUniqueId()
@ernsheong
ernsheong / access-mac-localhost-from-parallels-desktop-ie-edge.md
Last active January 24, 2024 00:30
Accessing macOS localhost from Parallels Desktop IE or Edge

Access macOS localhost from IE or Edge within Parallels Desktop

This issue is so infuriating that I'm going to take some time to write about it.

  1. MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g. polymer serve --hostname domain.local, hugo serve --bind 0.0.0.0. If you use a named domain like domain.local, it has to be defined in /etc/hosts and pointing at 0.0.0.0.

  2. My Parallels setting is using Shared Network, nothing special there.

  3. Open macOS Terminal and type ifconfig. Look for the value under vnic0 > inet. It is typically 10.211.55.2.

@rambabusaravanan
rambabusaravanan / .gitconfig
Last active May 30, 2024 06:08
Git Diff and Merge Tool - IntelliJ IDEA
# Linux
# add the following to "~/.gitconfig" file
[merge]
tool = intellij
[mergetool "intellij"]
cmd = /usr/local/bin/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
[diff]
@Rich-Harris
Rich-Harris / service-workers.md
Last active May 25, 2024 13:55
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@medynski
medynski / fpsMeter.js
Last active February 2, 2024 17:03
JavaScript FPS meter - Calculating frames per second
function fpsMeter() {
let prevTime = Date.now(),
frames = 0;
requestAnimationFrame(function loop() {
const time = Date.now();
frames++;
if (time > prevTime + 1000) {
let fps = Math.round( ( frames * 1000 ) / ( time - prevTime ) );
prevTime = time;
@corellian
corellian / qtranslate_widget.php
Created May 4, 2016 09:21
Wordpress qTranslate-X language selector shortcode
/**
* Language Selector Shortcode
*/
function qtranxf_generateLanguageSelectorShortcode() {
global $q_config;
if(is_404()) $url = get_option('home'); else $url = '';
echo PHP_EOL.'<div style="text-transform: uppercase;" class="lang-sel sel-dropdown"><a href="#"><span>'.$q_config['language'].'</span></a><ul>'.PHP_EOL;
foreach(qtranxf_getSortedLanguages() as $language) {
@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@tullmann
tullmann / waitForX
Created November 13, 2015 19:02
wait for an X11 server to be ready (good for running under XVFB when testing chrome)
#!/bin/bash
#
# waitForX [<cmd> [<arg> ...]]
#
# Wait for X Server to be ready, then run the given command once X server
# is ready. (Or simply return if no command is provided.)
#
function LOG {
echo $(date -R): $0: $*