Skip to content

Instantly share code, notes, and snippets.

View calogxro's full-sized avatar

calogxro

View GitHub Profile
@willurd
willurd / web-servers.md
Last active July 23, 2024 17:12
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@benheu
benheu / custom-shortcode-wp-user.php
Last active June 6, 2017 01:40
MailPoet 2.X - Custom shortcodes - How to retrieve normal WP user data?
<?php
/**
*
* @param string $tag_value
* @param int $user_id mailpoet's subscriber id
* @return type
*/
function mailpoet_shortcodes_custom_filter( $tag_value , $user_id ) {
@tkambler
tkambler / gist:71050d80f1a57ea83c18
Last active June 14, 2024 18:25
Calculate size of used LocalStorage space
/**
* Returns the total amount of disk space used (in MB) by localStorage for the current domain.
*/
var getLocalStorageSize = function() {
var total = 0;
for (var x in localStorage) {
// Value is multiplied by 2 due to data being stored in `utf-16` format, which requires twice the space.
var amount = (localStorage[x].length * 2) / 1024 / 1024;
total += amount;
}
@butlerblog
butlerblog / wp_config.php
Last active February 1, 2024 09:00
Configure WordPress #wp_mail function to send through #SMTP server https://b.utler.co/Y3
<?php
/*
* Set the following constants in wp-config.php.
* These should be added somewhere BEFORE the constant ABSPATH is defined.
*
* Author: Chad Butler
* Author URI: https://butlerblog.com
*
* For more information and instructions, see: https://b.utler.co/Y3
@nepsilon
nepsilon / how-to-git-patch-diff.md
Last active July 22, 2024 07:11
How to generate and apply patches with git? — First published in fullweb.io issue #33

How to generate and apply patches with git?

It sometimes happen you need change code on a machine from which you cannot push to the repo. You’re ready to copy/paste what diff outputs to your local working copy.

You think there must be a better way to proceed and you’re right. It’s a simple 2 steps process:

1. Generate the patch:

git diff &gt; some-changes.patch
@estk
estk / main.go
Created December 14, 2016 21:12
A Tour of Go: Web Crawler Solution
package main
import (
"fmt"
"sync"
)
type Crawler struct {
crawled map[string]bool
mux sync.Mutex
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active July 20, 2024 14:39
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@YumaInaura
YumaInaura / 00_README.md
Last active June 9, 2024 17:39
Golang — Understanding channel, buffer, blocking, deadlock and happy groutines.

Golang — Understanding channel, buffer, blocking, deadlock and happy groutines.

I was so confused to understand behaviior of Golang channels, buffer, blocking, deadlocking and groutines.

I read Go by Example topics.

@vsubhash
vsubhash / com.vsubhash.js.YoutubeLite.user.js
Created July 7, 2020 18:49
Loads a lite version of Youtube and adds RSS, links to video pages, and downloads for video and subtitles. (Youtube stopped support for old versions of Firefox.) This script supersedes that of Youtube Annoyance Remover.
// ==UserScript==
// @name YoutubeLite
// @namespace com.vsubhash.js.YoutubeLite
// @description Loads a lite version of Youtube, adds video file downloads and subtitle links
// @include https://www.youtube.com/watch*
// @version 2020.07.07
// @grant none
// ==/UserScript==