Skip to content

Instantly share code, notes, and snippets.

git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
git config --global --unset http.proxy
@yoclove
yoclove / gist:1332fddcf1f707b26fca09772ca769c6
Created December 12, 2018 03:22 — forked from millermedeiros/gist:891886
iPad HTML5 video quirks and hacks
/*
* Example how to preload HTML5 video on the iPad (iOS 3.2+)
* @author Miller Medeiros
* Released under WTFPL
*/
var vid = document.createElement('video');
vid.src = 'lol_catz.mp4';
document.getElementById('video-holder').appendChild(vid);
@yoclove
yoclove / login_jingdong.py
Created November 29, 2018 02:35 — forked from ladder1984/login_jingdong.py
自动登录京东网,基于requests、pyquery。
# -*- coding: utf-8 -*-
import requests
from pyquery import PyQuery as pq
login_url = "https://passport.jd.com/new/login.aspx"
login_post_url = "http://passport.jd.com/uc/loginService"
# 用户名和密码
username = "your_name"
password = "your_password"
@yoclove
yoclove / how-to-download-lynda.md
Created January 9, 2018 05:27 — forked from DonRichards/how-to-download-lynda.md
How to Download Lynda with youtube-dl

How to Download Lynda with youtube-dl with an organization login

Needed:

Cookies Export youtube-dl

  • Install Cookies Export
  • Login to Lynda and navigate to the course you want
  • Cookies export button in browser
  • Copy "cookie.txt" to your desktop
@yoclove
yoclove / main.js
Created January 1, 2018 12:37 — forked from unr/main.js
Simplistic Axios in VueJs Example
const axiosconfig = {
baseurl: 'https://site.com/api/',
timeout: 30000,
};
import Vue from 'vue';
import axios from 'axios';
// Setting up Axios on Vue Instance, for use via this.$axios
Vue.prototype.$axios = axios.create(axiosConfig);
@yoclove
yoclove / register_cmb2_metabox_after_title.php
Created December 15, 2017 02:27 — forked from j-mccarthy/register_cmb2_metabox_after_title.php
register cmb2 metabox after title on admin page edit screen
<?php
add_action( 'cmb2_init', 'source_banner_metabox' );
function source_banner_metabox() {
$prefix = '_source_demo_';
$cmb_demo = new_cmb2_box( array(
'id' => $prefix . 'metabox',
<?php
/**
* Taxonomy Post Columns
* @link http://www.billerickson.net/code/add-taxonomy-to-edit-post-columns
*
* @package Core_Functionality
* @since 1.0.0
* @link https://github.com/billerickson/Core-Functionality
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
@yoclove
yoclove / wp-submenu.php
Created November 26, 2017 09:37 — forked from ivankristianto/wp-submenu.php
WordPress show submenu based on active parent menu
<?php
// add hook
add_filter( 'wp_nav_menu_objects', 'my_wp_nav_menu_objects_sub_menu', 10, 2 );
// filter_hook function to react on sub_menu flag
function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) {
if ( isset( $args->sub_menu ) ) {
$root_id = 0;
@yoclove
yoclove / add-custom-post-type-menu.php
Created November 25, 2017 06:29 — forked from tommcfarlin/add-custom-post-type-menu.php
[WordPress] Add a custom post type menu as a child of an existing custom post type menu.
<?php
// Define the 'Portfolio' post type. This is used to represent galleries
// of photos. This will be our top-level custom post type menu
$args = array(
'labels' => array(
'all_items' => 'Gallery',
'menu_name' => 'Portfolio',
'singular_name' => 'Gallery',
'edit_item' => 'Edit Gallery',
function print_sub_menus() {
    global $post;

    // get current page
    $post_id = $post ? $post->ID : -1;
    $has_post_parent = $post && $post->post_parent;
    $top = $has_post_parent ? array_pop( get_post_ancestors($post_id) ) : $post_id;

 // get all main menu items