Skip to content

Instantly share code, notes, and snippets.

// 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 / 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 / lightbox.css
Created June 10, 2016 07:20 — forked from Shiti/lightbox.css
AngularJS Lightbox directive
.modal {
width: 800px;
left: 40%;
}
.lightbox-content {
width: 100%;
}
.lightbox-image {
@jwebcat
jwebcat / detect-mobile-browser.js
Created June 2, 2016 07:56 — forked from niksmac/detect-mobile-browser.js
Nodejs Express code to redirect mobile user agets
var express = require('express'),
app = express();
app.listen(80);
app.get('/', function(req, res){
var ua = req.header('user-agent');
// Check the user-agent string to identyfy the device.
if(/mobile|iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile|ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(ua)) {
res.sendfile(__dirname + '/mobile.html');
} else {
res.sendfile(__dirname + '/index.html');
@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 / duo-2-gulpfile.js
Created October 23, 2014 01:13
another version of gulp with duo
var duo = require('duo'); // https://github.com/duojs/duo
var map = require('map-stream'); // https://github.com/dominictarr/map-stream
var paths = {
build: {
src: {
jsApp: ['./src/js/main.js'],
jsClient: ['./src/js/client.js']
},
@jwebcat
jwebcat / duo-gulpfile.js
Created October 23, 2014 01:11
this is to run duo with gulp
/**
* Module Dependencies
*/
var map = require('map-stream');
var Duo = require('../../');
var gulp = require('gulp');
/**
* Default
if [ ! -d "htdocs" ]; then
echo 'Installing WordPress (release version) in realestate/htdocs...'
mkdir ./htdocs
cd ./htdocs
wp core download --allow-root
wp core config --dbname="realestate" --dbuser=wp --dbpass=wp --dbhost="localhost" --allow-root
wp core install --url=realestate.dev --title="realestate - A WordPress Site" --admin_user=admin --admin_password=password --admin_email=demo@example.com --allow-root
cd -
else
echo 'Updating WordPress in realestate/htdocs...'
/**
* Checks if a particular user has a role.
* Returns true if a match was found.
*
* @param string $role Role name.
* @param int $user_id (Optional) The ID of a user. Defaults to the current user.
* @return bool
*/
function appthemes_check_user_role( $role, $user_id = null ) {
// scroll to div
$(function($){
$('a.nav').click(function() {
var $this = $(this),
_href = $this.attr('href'),
dest = $(_href).offset().top;
$("html:not(:animated),body:not(:animated)").animate({ scrollTop: dest}, 400 );
return false;
});
});