Skip to content

Instantly share code, notes, and snippets.

View rahul286's full-sized avatar
😷

Rahul Bansal rahul286

😷
View GitHub Profile
@rahul286
rahul286 / create-usb.sh
Last active May 23, 2020 17:07 — forked from doug-orchard/create-usb.sh
Creating a Bootable Windows USB from ISO on a Mac
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
# This will output a bunch of info about all of the disk drives connected to
# your Mac. Each entry will have a header in the form "/dev/diskX", where X is
# some number starting at 0. Now, insert your USB drive and run the command
# again. You should see a new entry. Make note of the name (ie, /dev/diskX).
diskutil list
@rahul286
rahul286 / ddd.md
Created April 23, 2019 12:44 — forked from zsup/ddd.md
Documentation-Driven Development (DDD)

Documentation-Driven Development

The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.

  • Document the feature first. Figure out how you're going to describe the feature to users; if it's not documented, it doesn't exist. Documentation is the best way to define a feature in a user's eyes.
  • Whenever possible, documentation should be reviewed by users (community or Spark Elite) before any development begins.
  • Once documentation has been written, development should commence, and test-driven development is preferred.
  • Unit tests should be written that test the features as described by the documentation. If the functionality ever comes out of alignment with the documentation, tests should fail.
  • When a feature is being modified, it should be modified documentation-first.
  • When documentation is modified, so should be the tests.
#!/bin/bash
# This script takes a remote repository and merges it into
# the current one as a subdirectory
set -e
if [ -z "$1" ]
then
echo "Usage:"
@rahul286
rahul286 / README.md
Last active July 11, 2018 15:16 — forked from milo2012/genPunycodeDomain.py
genPunycodeDomain.py

Install deps using

pip install ipwhois

You may need to prefix above command with sudo if you are using python version that ships with system. Or change ownership (not recommended) by running sudo chown -R $USER /Library/Python/2.7

Download script and execute it

@rahul286
rahul286 / docker-examples.md
Created December 4, 2017 09:44 — forked from thaJeztah/docker-examples.md
Some docker examples

Commit, clone a container

To 'clone' a container, you'll have to make an image of that container first, you can do so by "committing" the container. Docker will (by default) pause all processes running in the container during commit to preserve data-consistency.

For example;

docker commit --message="Snapshot of my container" my_container my_container_snapshot:yymmdd
@rahul286
rahul286 / 0_reuse_code.js
Created December 28, 2016 16:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rahul286
rahul286 / run-wp-cron.sh
Created May 27, 2016 14:24 — forked from bjornjohansen/run-wp-cron.sh
Run all due cron events for WordPress with WP-CLI. Works with both single sites and multisite networks.
#!/bin/bash
# Copyright © 2015 Bjørn Johansen
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
WP_PATH="/path/to/wp"
# Check if WP-CLI is available
if ! hash wp 2>/dev/null; then
@rahul286
rahul286 / azure-blob-xplat-cli-sample
Last active October 28, 2015 14:26 — forked from mwinkle/azure-blob-xplat-cli-sample
Azure XPlat CLI in order to list and download blobs
# first, make sure you have downloaded the Azure XPlat CLI
# http://azure.microsoft.com/en-us/documentation/articles/xplat-cli/#install
# eg, sudo npm install azure-cli -g
# login to Azure (will prompt for your username/password or will ask you to open link http://aka.ms/devicelogin in browser)
azure login
# optional - if you have multiple accounts
## list subscriptions
azure account list

Ghost is an open source platform for blogging founded by John O'Nolan and Hannah Wolfe. It's a node.js application and therefore works great in conjunction with nginx. This guide will will help you create a high performance nginx virtual host configuration for Ghost.

"Don't use #nodejs for static content" - @trevnorris. If #nginx isn't sitting in front of your node server, you're probably doing it wrong.

— Bryan Hughes (@nebrius) August 30, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

The node.js application runs on a port on your server. We can configure nginx to proxy to this port and also cache so that we don't need to rely on express, the default n

<?php
//* Using the Gravity Forms editor, be sure to check "Allow field to be populated dynamically under Advanced Options
//* You will need to set the Field Parameter Name value to work with the filter as follows: gform_field_value_$parameter_name
//* Dynamically populate first name for logged in users
add_filter('gform_field_value_first_name', 'populate_first_name');
function populate_first_name($value){
global $current_user;
get_currentuserinfo();
return $current_user->user_firstname;