Skip to content

Instantly share code, notes, and snippets.

@jwebcat
jwebcat / gist:5122366
Last active March 25, 2024 18:25 — forked from lemenkov/gist:1674929
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@jwebcat
jwebcat / ngrok-installation.md
Created December 23, 2015 06:58 — forked from wosephjeber/ngrok-installation.md
Installing ngrok on Mac

#Installing ngrok on OSX

  1. Download ngrok
  2. Unzip it to your Applications directory
  3. Create a symlink (instructions below)

Creating a symlink to ngrok

Run the following two commands in Terminal to create the symlink.

# cd into your local bin directory
@jwebcat
jwebcat / _mq.scss
Last active February 22, 2020 21:21
handy sass mixin for media queries
$break-small: 320px;
$break-large: 1024px;
@mixin respond-to($media) {
@if $media == handhelds {
@media only screen and (max-width: $break-small) { @content; }
}
@else if $media == medium-screens {
@media only screen and (min-width: $break-small + 1) and (max-width: $break-large - 1) { @content; }
}
@jwebcat
jwebcat / hack.sh
Last active July 16, 2019 18:09
run a windows batch script with args from git bash
#!/bin/bash
$COMSPEC /c batch-file\ \"$var1\"\ \"$var2\"
@jwebcat
jwebcat / cpt-to-main-loop.php
Created January 24, 2014 08:18
Add custom post types to pre_get_posts for main loop WP
add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) {
if ( is_category() && $query->is_main_query() )
$query->set( 'post_type', array( 'post', 'page', 'fonts' ) );
return $query;
}
@jwebcat
jwebcat / auto-coupon-woo.php
Created January 24, 2014 08:20
Automatically apply coupon to cart WooCommerce
add_action( 'woocommerce_before_cart', 'apply_matched_coupons' );
function apply_matched_coupons() {
global $woocommerce;
$get1 = 'getonech'; // your coupon code here
$get2 = 'gettwoch'; // your coupon code here
$get3 = 'getthreech'; // your coupon code here
$get4 = 'getfourch'; // your coupon code here
$get5 = 'getfivech'; // your coupon code here
// Set interval at about 2000 ms for this script
// ALERTS: Alerts you when the price crosses the alert price
// SPIKES: Alerts you when the price spikes x percentage in either direction
// 0.1 means a distance of 0.1 % from either the high or the low of the current candle and timeframe
// Settings
var ALERTS = [6500, 6700]
var SPIKES = [0.2, 0.4, 0.6]
// Milliseconds to wait for the script to reset after you have turned it off. Lower values make it reset more often
@jwebcat
jwebcat / color-var.sh
Created March 11, 2013 06:47
bash ansi color variables
RED='\033[00;31m'
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
BLUE='\033[00;34m'
PURPLE='\033[00;35m'
CYAN='\033[00;36m'
LIGHTGRAY='\033[00;37m'
LRED='\033[01;31m'
LGREEN='\033[01;32m'
@jwebcat
jwebcat / add_two_times.js
Last active November 5, 2017 11:32 — forked from joseluisq/add_two_times.js
Sum two times values HH:mm:ss with javascript
/**
* Sum two times values HH:mm:ss with javascript
* Usage:
* > addTimes('04:20:10', '21:15:10');
* > "25:35:20"
*
* @param {string} start
* @param {string} end
* @returns {String}
*/
@jwebcat
jwebcat / triangle.scss
Last active June 15, 2017 11:56
scss triangle mixin
//==== Simple SCSS mixin to create CSS triangles
//==== Example: @include css-triangle("up", 10px, #fff);
@mixin css-triangle($direction: "down", $size: 20px, $color: #000) {
width: 0;
height: 0;
border-left: $size solid #{setTriangleColor($direction, "left", $color)};
border-right: $size solid #{setTriangleColor($direction, "right", $color)};
border-bottom: $size solid #{setTriangleColor($direction, "bottom", $color)};
border-top: $size solid #{setTriangleColor($direction, "top", $color)};
}