Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Nate McMaster natemcmaster

💭
I may be slow to respond.
View GitHub Profile
@natemcmaster
natemcmaster / web.config
Last active Dec 19, 2015
Configuring CakePHP on Azure
View web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect static resources" stopProcessing="true">
<match url="^(ico|img|css|files|js|font)(.*)$" />
<action type="Rewrite" url="app/webroot/{R:1}{R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 1" stopProcessing="true">
@natemcmaster
natemcmaster / myip_cygwin.sh
Last active Dec 20, 2015
Bash command for getting the local machine ip address from ipconfig
View myip_cygwin.sh
ipconfig | grep 'IPv4' | awk -F ': ' '{print $2}'
@natemcmaster
natemcmaster / truncation.cpp
Created Sep 19, 2013
Demo of integer math vs. double math
View truncation.cpp
#include <iostream>
using namespace std;
int main(){
int half = 3/2;
cout << half << endl; //Prints 1 because int's throw away the decimal
double intMath= 3 / 2;
cout<<intMath<<endl; //Prints 1, not what we expected
@natemcmaster
natemcmaster / Fruit.cpp
Created Sep 21, 2013
Sample of inheritance and vectors.
View Fruit.cpp
/*
* Fruit.cpp
*
* Created on: Sep 21, 2013
* Author: nmcmaster
*/
#include "Fruit.h"
using namespace std;
@natemcmaster
natemcmaster / boolean.cpp
Last active Dec 23, 2015
Tutoring: sample of various ways to use bool in C++
View boolean.cpp
#include <iostream>
using namespace std;
bool foobar(int f){
return (f==7);
}
int main(){
bool foobarcondition=foobar(7);
@natemcmaster
natemcmaster / pointers.cpp
Created Sep 25, 2013
Tutoring: sample of how to various ways use pointers.
View pointers.cpp
#include <iostream>
#include <string>
using namespace std;
void appendAuthorName(string* bookTitle){
*bookTitle = *bookTitle + ": by J.K. Rowling"; // notice how I am modifying bookTitle but not returning anything. I am modifying the string directly
}
@natemcmaster
natemcmaster / scoping.cpp
Created Sep 25, 2013
Tutoring: demonstration of variable scope in C++;
View scoping.cpp
#include <iostream>
using namespace std;
void someFunction();
int number = 0; // Scoped globally (everywhere inside this C++ program)
@natemcmaster
natemcmaster / looping.cpp
Created Oct 1, 2013
Tutoring: demo of using loops to get user input from cin
View looping.cpp
#include <iostream>
using namespace std;
int main()
{
double miles;
cout << "Enter miles:" << endl;
@natemcmaster
natemcmaster / queue.cpp
Created Oct 9, 2013
Tutoring: example of creating a simple data structure with dynamic memory allocation and avoiding memory leaks
View queue.cpp
#include <iostream>
#include "queue.hpp"
Queue::Queue():head(NULL),tail(NULL){
}
void Queue::add(int insertValue){
Node* nextItem = new Node();
nextItem->value = insertValue;
View nm.zsh-theme
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
PROMPT='%{$fg[$NCOLOR]%}%m:%c ➤ %{$reset_color%}'
RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="*"
ZSH_THEME_GIT_PROMPT_CLEAN=""
You can’t perform that action at this time.