Skip to content

Instantly share code, notes, and snippets.

View voice-alerts.js
// 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 Nov 5, 2017 — forked from joseluisq/add_two_times.js
Sum two times values HH:mm:ss with javascript
View add_two_times.js
/**
* 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 Jun 10, 2016 — forked from Shiti/lightbox.css
AngularJS Lightbox directive
View lightbox.css
.modal {
width: 800px;
left: 40%;
}
.lightbox-content {
width: 100%;
}
.lightbox-image {
@jwebcat
jwebcat / detect-mobile-browser.js
Created Jun 2, 2016 — forked from niksmac/detect-mobile-browser.js
Nodejs Express code to redirect mobile user agets
View detect-mobile-browser.js
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');
View ngrok-installation.md

#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 Oct 23, 2014
another version of gulp with duo
View duo-2-gulpfile.js
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 Oct 23, 2014
this is to run duo with gulp
View duo-gulpfile.js
/**
* Module Dependencies
*/
var map = require('map-stream');
var Duo = require('../../');
var gulp = require('gulp');
/**
* Default
View vvv.init.sh
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...'
View access.php
/**
* 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 ) {
View scroll-to.jquery.js
// 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;
});
});
You can’t perform that action at this time.