Skip to content

Instantly share code, notes, and snippets.

View shramee's full-sized avatar
🥳
Coding party

Shramee Srivastav shramee

🥳
Coding party
View GitHub Profile
#! /bin/bash
######################################################################
#
# This script generates an SSL certficate for local development. To
# execute the script, run `bash create-dev-ssl-cert.sh`. Sudo is
# needed to save the certificate to your Mac KeyChain. After the cert
# is generated, you can use `HTTPS=true yarn start` to run the web
# server.
#
@ciorici
ciorici / index.php
Created April 27, 2017 08:10
Featured Products Loop in WooCommerce 3.0
<ul class="products">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 12,
'tax_query' => array(
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
@shramee
shramee / p5-particles.js
Last active March 1, 2017 06:33
Creates random particles with customizable properties
/**
* Created by shramee on 28/02/17.
*/
var particles = {},
particleProps = {},
particleFixOutOfViewport = function ( p, k ) {
var
flipSign = 1,
max = particleProps[ k + 'Max'];
if ( p[k] > max/2 ) { // if particle is in greater half
@mrkpatchaa
mrkpatchaa / README.md
Last active April 4, 2024 09:37
Bulk delete github repos

Use this trick to bulk delete your old repos or old forks

(Inspired by https://medium.com/@icanhazedit/clean-up-unused-github-rpositories-c2549294ee45#.3hwv4nxv5)

  1. Open in a new tab all to-be-deleted github repositores (Use the mouse’s middle click or Ctrl + Click) https://github.com/username?tab=repositories

  2. Use one tab https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall to shorten them to a list.

  3. Save that list to some path

  4. The list should be in the form of “ur_username\repo_name” per line. Use regex search (Sublime text could help). Search for ' |.*' and replace by empty.

@kalinchernev
kalinchernev / Form.class.php
Created January 20, 2014 11:14
Basic class to build a form from an array
<?php
/**
* Form Class
*
* Responsible for building forms
*
* @param array $elements renderable array containing form elements
*
* @return void
@rosszurowski
rosszurowski / lerp-color.js
Last active March 3, 2023 12:14
Linear interpolation for hexadecimal colors.
/**
* A linear interpolator for hexadecimal colors
* @param {String} a
* @param {String} b
* @param {Number} amount
* @example
* // returns #7F7F7F
* lerpColor('#000000', '#ffffff', 0.5)
* @returns {String}
*/
@seanbuscay
seanbuscay / git_create_orphan.sh
Created June 27, 2013 15:26
Create an orphan branch in a repo.
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name
@wpscholar
wpscholar / functions.php
Last active March 1, 2021 13:26
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@menzerath
menzerath / backup.php
Last active February 18, 2024 19:33
PHP: Recursively Backup Files & Folders to ZIP-File
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* MIT-License - 2012-2018 Marvin Menzerath
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit', '1024M');
@mikejolley
mikejolley / gist:2044101
Last active May 18, 2021 17:02
WooCommerce - Show number of items in cart and total
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>