Skip to content

Instantly share code, notes, and snippets.

View matthewkastor's full-sized avatar

Kastor matthewkastor

  • Atropa Inc. Intl.
  • Michigan
View GitHub Profile
@matthewkastor
matthewkastor / Continuous Integration for PHP on XAMPP.html
Created September 12, 2012 19:18 — forked from anonymous/altered_xampp_shell.bat
Continuous Integration for PHP on XAMPP
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
lang="en-us"
xml:lang="en-us">
<head>
<meta http-equiv="content-type"
content="text/html; charset=utf-8" />
<title>
@matthewkastor
matthewkastor / array.intersect.js
Created January 23, 2013 06:21
JavaScript Array intersection functions. Check out the performance tests at http://jsperf.com/nopub/2
/**
* See: http://stackoverflow.com/a/1885766
*
* Note: because this function transfers array values
* to an object's properties, the result set will consist
* of unique values. Given [1,2,3,3] and [3,3,4,5] this
* function will return [3].
*
* This function attempts to avoid doing extra work
* by assigning all values from the array given as
@matthewkastor
matthewkastor / CKEditor.SourceViewReplacer.js
Last active June 1, 2017 12:12
This class allows you to easily replace the source view in CKEditor with any web based code editor e.g. Ace, Code Mirror, etc.
/*jslint
indent: 4,
maxerr: 50,
white: true,
browser: true,
vars: true
*/
/*global
CKEDITOR
*/
@matthewkastor
matthewkastor / README.md
Created September 13, 2013 06:47
A jison file with comments about jison file structure and demonstrating how to create a grammar that can recognize comments.

The jison grammar file describes a parser that recognizes HTML style comments. It should be simple to change the grammar to recognize any other markup for multiline comments. I've put a lot of notes in the grammar file about it's structure and links to where I found the information.

To generate the comment parser you'll need jison installed. Then run commentsParserGenerator.js through Node, it will read comments.jison and generate the parser as comments.js. It will then run comments.js over comments.txt and display the results.

@echo off
REM Put the standalone server, chromedriver, IEdriver,
REM the HTML test suite, and your user-extensions.js file
REM all in the same folder. Then you can run this bat file
REM to launch everything real easy like.
REM *firefox
REM *mock
REM *firefoxproxy
@matthewkastor
matthewkastor / NUnitParameterizedTestsExample.cs
Created January 14, 2016 20:08
Combining lists of values into parameterized test data (specs) for NUnit
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace NUnitParameterizedTestsExample
{
/// <summary>
/// Parameterize all the tests
/// </summary>
[TestFixture]
@matthewkastor
matthewkastor / mql Get Moving Average.mq4
Created January 23, 2016 20:43
function for calculating the moving average of the current currency pair in metatrader 4
double GetMovingAverage() {
return iMA(NULL,0,MovingPeriod,MovingShift,MODE_EMA,PRICE_TYPICAL,0);
}
@matthewkastor
matthewkastor / mql Get MACD.mq4
Last active January 23, 2016 21:07
functions for getting the MACD indicator in metatrader 4
input int MovingPeriod = 12;
input int MovingShift = 0;
double GetMacd(int mode, int period, int shift) {
int fastEmaPeriod = period / 2.1555;
int slowEmaPeriod = period;
int signalPeriod = (period / 2.1555) * 0.75;
return iMACD(Symbol(),0,fastEmaPeriod,slowEmaPeriod,signalPeriod,PRICE_TYPICAL,mode,shift);
}
@matthewkastor
matthewkastor / mql Get Candle Strength.mq4
Last active January 23, 2016 20:54
function for analyzing whether the candle body is at least 30 percent of its height in metatrader 4
// bool candleIsStrong = CandleIsStrong(1);
bool CandleIsStrong(int index) {
bool output = false;
double totalHeight = High[index] - Low[index];
double bodyHeight = MathAbs(Open[index] - Close[index]);
if(totalHeight != 0 && bodyHeight != 0) {
output = ((totalHeight / bodyHeight) > 1.3);
}
@matthewkastor
matthewkastor / mql Get Candle Direction.mq4
Last active January 23, 2016 20:53
function for getting the candle direction in metatrader 4
//int candleDirection = CandleDirection(1);
int CandleDirection(int index){
int output = 0;
if(Open[index] < Close[index]) {
output = 1;
}
if(Open[index] > Close[index]) {
output = -1;
}