Skip to content

Instantly share code, notes, and snippets.

View mattearly's full-sized avatar

Matthew Early mattearly

View GitHub Profile
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
!LButton::
MouseClick, Left,X,Y,20,1,
return
mega_click = y
.data
names: .space 16
ryan: .asciiz "Ryan\n"
tammi: .asciiz "Tammi\n"
josh: .asciiz "Josh\n"
robert: .asciiz "Robert\n"
.text
#include <iostream>
static long num_steps = 100000;
double step;
void main() {
int i;
double x=0.0,pi=0.0,sum=0.0;
step = 1.0/(double)num_steps;
for (i=0;i<num_steps;i++) {
// be sure you have ncurses installed
// compile with 'g++ ncurses_hello_world.cpp.cc -lcurses'
#include <ncurses.h>
int main()
{
initscr(); /* Start curses mode */
printw("Hello World !!!"); /* Print Hello World */
refresh(); /* Print it on to the real screen */
#include <string>
#include <iostream>
// made to help with my printer and printing both sides
int main () {
std::cout << "This program prints numbers in sequence with comma seperated values as either even or odd\n";
int choice;
while (choice == 0 && choice != 1 && choice != 2) {
std::cout << "1 for odd, 2 for even: ";
(define (remove-nth n l)
(cond ((= n 0) l )
((null? l) l)
(else (cons (car l) (remove-nth (- n 1) (cdr l))))
)
)
(*find i within the lst*)
let rec member i lst =
match lst with
[] -> false
| hd::tl -> hd = i || member i tl;;
(*with if else instead*)
@mattearly
mattearly / trim.h
Created April 16, 2017 00:35
python-like trim for c++
#pragma once
#include <string>
//because other langauges have these and the c++ does not
//Trims whitespace - from http://stackoverflow.com/questions/1798112/removing-leading-and-trailing-spaces-from-a-string
std::string trim(const std::string& str,
const std::string& whitespace = " \t")
{
const auto strBegin = str.find_first_not_of(whitespace);
@mattearly
mattearly / split.h
Created April 16, 2017 00:36
python-like split for c++
#pragma once
#include <string>
#include <sstream>
#include <vector>
#include <iterator>
// split function for c++ -- from http://stackoverflow.com/questions/236129/split-a-string-in-c
template<typename Out>
@mattearly
mattearly / findString_noCase.h
Created April 16, 2017 00:38
function for searching without caring about case matching
#include <string>
#include <cctype>
bool findStringIC(const std::string & strHaystack, const std::string & strNeedle) {
auto it = std::search(
strHaystack.begin(), strHaystack.end(),
strNeedle.begin(), strNeedle.end(),
[](char ch1, char ch2) { return std::tolower(ch1) == std::tolower(ch2); }
);
return (it != strHaystack.end() );