Skip to content

Instantly share code, notes, and snippets.

@mszkb
mszkb / gist:89b6978327e5315c11ec6ad9f5ee82ba
Last active January 31, 2017 10:17 — forked from blainerobison/gist:fecf1bba78527712fd6e
Wordpress Metadata - Update Metadata after Upload
/**
* Add attachment metadata
*
* By default, WordPress only adds '_wp_attachment_metadata' metadata to images, audio and video files.
* This hooks into 'wp_update_attachment_metadata' and sets 'file' to the value of '_wp_attached_file'.
*/
function prefix_update_attachment_metadata( $data, $post_id ) {
// only set 'file' if needed
if ( isset( $data['file'] ) ) {
<?php
/*
Extends Visual Composer
More information can be found here: http://kb.wpbakery.com/index.php?title=Category:Visual_Composer
*/
// don't load directly
@mszkb
mszkb / install-docker.sh
Created August 2, 2018 04:55 — forked from dweldon/install-docker.sh
Install docker CE on Linux Mint 18.3
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
sudo apt-get update
sudo apt-get install docker-ce
# https://docs.docker.com/compose/install/

When you modify a file in your repository, the change is initially unstaged. In order to commit it, you must stage it—that is, add it to the index—using git add. When you make a commit, the changes that are committed are those that have been added to the index.

git reset changes, at minimum, where your current branch is pointing. The difference between --mixed and --soft is whether or not your index is also modified. So, if we're on branch master with this series of commits:

- A - B - C (master)

HEADpoints to C and the index matches C.

--soft

@mszkb
mszkb / es6-spread-immutable-cheatsheet.md
Last active January 14, 2019 08:30 — forked from gorangajic/es6-spread-immutable-cheatsheet.md
es6 spread immutable cheatsheet

EDIT: original uses the var for declaring variables. In this fork all var are replaced with let.

update object

let state = {
    id: 1,
    points: 100,
    name: "Goran"
};
@mszkb
mszkb / MockFile.js
Created March 18, 2020 07:21 — forked from josephhanson/MockFile.js
Mock file for JavaScript based file upload - with basic test harness
// mock file
function MockFile() { };
MockFile.prototype.create = function (name, size, mimeType) {
name = name || "mock.txt";
size = size || 1024;
mimeType = mimeType || 'plain/txt';
function range(count) {
var output = "";
@mszkb
mszkb / nginx.conf
Last active November 13, 2020 08:59 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# for detailed explaination @see # https://gist.github.com/plentz/6737338
server_tokens off;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ssl.google-analytics.com https://assets.zendesk.com https://connect.facebook.net; img-src 'self' https://ssl.google-analytics.com https://s-static.ak.facebook.com https://assets.zendesk.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://assets.zendesk.com; font-src 'self' https://themes.googleusercontent.com; frame-src https://assets.zendesk.com https://www.facebook.com https://s-static.ak.facebook.com https://tautt.zendesk.com; object-src 'none'";
# as we use Azure the SSL part is done by the WebApp Service
server {
listen 80 default;