Skip to content

Instantly share code, notes, and snippets.

View vividvilla's full-sized avatar

Vivek R vividvilla

View GitHub Profile
@vividvilla
vividvilla / ca.md
Created January 31, 2022 06:47 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@vividvilla
vividvilla / custom_time.go
Created June 10, 2021 07:01 — forked from lummie/custom_time.go
Golang custom date / time formats when marshalling to JSON
// CustomTime provides an example of how to declare a new time Type with a custom formatter.
// Note that time.Time methods are not available, if needed you can add and cast like the String method does
// Otherwise, only use in the json struct at marshal/unmarshal time.
type CustomTime time.Time
const ctLayout = "2006-01-02 15:04:05 Z07:00"
// UnmarshalJSON Parses the json string in the custom format
func (ct *CustomTime) UnmarshalJSON(b []byte) (err error) {
@vividvilla
vividvilla / osxtweaks
Created January 8, 2020 10:45 — forked from webdevbrian/osxtweaks
Brian's List of OSX Tweaks for web developers
#OSX Tweaks:
===========
- Most need reboot to show changes
- Most of these tweaks are just for speed, but some are specific for development
- All of these are to be ran in terminal. The commands to be copy and pasted start after the less-than sign.
- I'm not responsible for any adverse effects to your computer, at all.
##Increase the speed of OS X dialogs boxes:
@vividvilla
vividvilla / migrate-fish-history-to-zsh.py
Created December 26, 2019 06:57 — forked from mateuspontes/migrate-fish-history-to-zsh.py
Migrate fish history to zsh shell (python 2.7)
import os
import re
def fish_to_zsh(cmd):
return (cmd.replace('; and ', '&&')
.replace('; or ', '||'))
with open(os.path.expanduser('~/.zsh_history.test'), 'a') as o:
with open(os.path.expanduser('~/.local/share/fish/fish_history')) as f:
for line in f:
// Intercepting HTTP calls with AngularJS.
angular.module('MyApp', [])
.config(function ($provide, $httpProvider) {
// Intercept http calls.
$provide.factory('MyHttpInterceptor', function ($q) {
return {
// On request success
request: function (config) {
// console.log(config); // Contains the data about the request before it is sent.
<?php
/**
* Loop Add to Cart -- with quantity and AJAX
* requires associated JavaScript file qty-add-to-cart.js
*
* @ref: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
* @ref: https://gist.github.com/mikejolley/2793710/
*/
// add this file to folder "woocommerce/loop" inside theme
// Create color style options
add_theme_support(
'genesis-style-selector',
array(
'latent-blue' => __( 'Blue', CHILD_DOMAIN ),
'latent-green' => __( 'Green', CHILD_DOMAIN ),
'latent-orange' => __( 'Orange', CHILD_DOMAIN ),
'latent-red' => __( 'Red', CHILD_DOMAIN ),
)
);