Skip to content

Instantly share code, notes, and snippets.

View muhfaris's full-sized avatar
:octocat:
Focusing

Muhammad Faris 'Afif muhfaris

:octocat:
Focusing
View GitHub Profile
@huytd
huytd / .gitconfig
Created August 4, 2016 16:26
Use neovim as diff tool
[merge]
tool = vimdiff
[mergetool]
prompt = true
[mergetool "vimdiff"]
cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
[difftool]
prompt = false
[diff]
tool = vimdiff
@khangvm53
khangvm53 / Varnish-for-Wordpress-Cookies-are-blocked-or-not-supported.md
Last active July 27, 2016 04:37
Varnish for Wordpress - Cookies are blocked or not supported
  • Find beresp.http.Set-Cookie and change it like the below
# Only allow cookies to be set if we're in admin area
	if (beresp.http.Set-Cookie && bereq.url !~ "/wp-(login|admin)") {
        	unset beresp.http.Set-Cookie;
    	}
  • The way forward cookie in varnish
@alyssaq
alyssaq / main.go
Last active June 20, 2018 03:58
GET and POST golang API
/*
* Sample API with GET and POST endpoint.
* POST data is converted to string and saved in internal memory.
* GET endpoint returns all strings in an array.
*/
package main
import (
"encoding/json"
"flag"
@ncserny
ncserny / varnish3-cloufdlare-wordpress-w3totalcache.vcl
Last active July 27, 2016 04:37
Varnish 3 VCL for Cloudflare + WordPress + W3 Total Cache
# Backend Server
backend default {
.host = "XXX.XXX.XXX.XXX"; # IP Address of your Web Server
.port = "80"; # Port of your Web Server
}
# Hosts allowed to purge Varnish
acl purge {
"localhost"; # Allow varnish to be purged from the same server it is running on
"XXX.XXX.XXX.XXX"/24; # IP of your web server that is allowed to purge the cache
@ErosLever
ErosLever / owasp-risk-rating.html
Last active November 25, 2022 15:51
This is a quick and dirty OWASP Risk Rating Calculator. (demo: https://tinyurl.com/owasp-calculator )
<!-- access this at: https://tinyurl.com/owasp-calculator -->
<html><head>
<style>
@import url('https://fonts.googleapis.com/css?family=Palanquin:400,700&display=swap');
html {
font-size: 16px !important;
}
body {
background-color: #000;
background-image: url(https://www.securenetwork.it/assets/images/bg-black.png);
@idavinder
idavinder / Remove Categories from Post Meta in WordPress
Created August 23, 2015 14:40
Remove Categories from Post Meta in WordPress
//* Remove categories from post meta - shared on basicwp.com
function the_category_filter($thelist,$separator=' ') {
if(!defined('WP_ADMIN')) {
//list the category names to exclude
$exclude = array('Featured', 'Category #1');
$cats = explode($separator,$thelist);
$newlist = array();
foreach($cats as $cat) {
$catname = trim(strip_tags($cat));
if(!in_array($catname,$exclude))
@SchumacherFM
SchumacherFM / db.go
Created February 15, 2015 00:13
GoLang Database SQL: Selecting an unknown amount of columns from a query. Benchmark results in db_test.go
package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"log"
)
const (
@branneman
branneman / better-nodejs-require-paths.md
Last active April 11, 2025 10:39
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions