Skip to content

Instantly share code, notes, and snippets.

@vmdao
vmdao / functions.php
Created August 22, 2019 09:59 — forked from downtownrob/functions.php
Saving Contact Form 7 data into a MailChimp List with checkbox and groupings
<?php
/*
Use: Add this code to the Wordpress theme's functions.php file.
Requires Mailchimp's MCAPI.class.php in the same folder as the theme's functions.php file.
Hi. I've tweaked this fork to add FNAME LNAME and GROUPINGS support, making this a super easy way to
use CF7 with Mailchimp's API, with a checkbox asking if they want to subscribe, without double-opt-in verification.
Use: Create a CF7 form with text fields first-name, last-name, your-email, and a checkbox field named subscribe, plus any others you like:
@vmdao
vmdao / revert-a-commit.md
Created July 22, 2019 07:01 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@vmdao
vmdao / revert-a-commit.md
Created July 22, 2019 07:01 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@vmdao
vmdao / #wd-drop-file.py
Created May 7, 2019 06:29 — forked from florentbr/#wd-drop-file.py
Selenium - Drop a file from the desktop on a drop area
from selenium import webdriver
from selenium.webdriver.remote.webelement import WebElement
import os.path
# JavaScript: HTML5 File drop
# source : https://gist.github.com/florentbr/0eff8b785e85e93ecc3ce500169bd676
# param1 WebElement : Drop area element
# param2 Double : Optional - Drop offset x relative to the top/left corner of the drop area. Center if 0.
# param3 Double : Optional - Drop offset y relative to the top/left corner of the drop area. Center if 0.
# return WebElement : File input
@vmdao
vmdao / #wd-drop-file.py
Created May 7, 2019 06:29 — forked from florentbr/#wd-drop-file.py
Selenium - Drop a file from the desktop on a drop area
from selenium import webdriver
from selenium.webdriver.remote.webelement import WebElement
import os.path
# JavaScript: HTML5 File drop
# source : https://gist.github.com/florentbr/0eff8b785e85e93ecc3ce500169bd676
# param1 WebElement : Drop area element
# param2 Double : Optional - Drop offset x relative to the top/left corner of the drop area. Center if 0.
# param3 Double : Optional - Drop offset y relative to the top/left corner of the drop area. Center if 0.
# return WebElement : File input
@vmdao
vmdao / gist:63e40197eac6d820c373cccda7eae574
Created July 9, 2018 14:38 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@vmdao
vmdao / redis_mysql_dump.js
Created July 9, 2018 13:22 — forked from m0llysour/redis_mysql_dump.js
Redis to MySQL dump
// modules
var redis = require('redis');
var Step = require('step');
// config file
var config = require('config');
// mysql client connect
var mysql = require('mysql');
var connection = mysql.createConnection({
@vmdao
vmdao / gist:74737670e41e0b58733ce50e8b87c2c5
Last active July 9, 2018 03:48
[CSS] The heigh automatically changes by the width

Create box width and Height ratio Thank Nghiep, go to link

<!--- code HTML -->
<div class="constant-width-to-height-ratio"></div>
# Code CSS

You can check here for getting the latest version. Change the wget url to download newer versions.

$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ cd wkhtmltox/bin/
$ sudo mv wkhtmltopdf /usr/bin/wkhtmltopdf
$ sudo mv wkhtmltoimage /usr/bin/wkhtmltoimage
$ sudo chmod a+x /usr/bin/wkhtmltopdf
@vmdao
vmdao / gist:37b60a5c4cebfa1692ebaba70885c6ee
Created January 4, 2018 02:57
Nginx config with container PHP
server {
listen 80;
listen [::]:80;
server_name domain.com;
return 301 https://$server_name;
}
server {