Skip to content

Instantly share code, notes, and snippets.

View musicm122's full-sized avatar
🏠
Working from home

Terrance Smith musicm122

🏠
Working from home
View GitHub Profile
open System
open System.Globalization
//---------------------------------------------------------------
// Apply Your Knowledge!
//
// Below is a list containing comma separated data about
// Microsoft's stock prices during March of 2012. Without
// modifying the list, programatically find the day with the
// greatest variance between the opening and closing price.
//
@musicm122
musicm122 / UserRespawnFix.cs
Last active December 27, 2015 12:49
Awesomely Hacky user respawn location code.
/// <summary>
/// Restores the player to the starting point to try the level again.
/// </summary>
public void StartNewLife()
{
//First try at default start position
Player.Position= start;
//get the distance from the player the enemies need to be
var playerRange = Enumerable.Range((int)Player.Position.X - 3, (int)Player.Position.X + 3);
@musicm122
musicm122 / prince1.js
Created October 22, 2013 22:00
prince1 to post
var Musician = {
FirstName:"Prince",
MiddleName:"Rogers",
LastName:"Nelson",
StageName:"Prince"
}
@musicm122
musicm122 / prince2.js
Created October 22, 2013 21:59
prince2 post
var Musician = {
FirstName:"Prince",
MiddleName:"Rogers",
LastName:"Nelson",
StageName:"Prince"
}
Musician.StageName ="The Artist Formerly know as "+Musician.StageName;
Musician.StageName ="Jamie Starr";
Musician.StageName ="Christopher";
Musician.StageName ="Alexander Nevermind";
@musicm122
musicm122 / PhysicsEdgeActor.cpp
Created September 28, 2013 22:35
around line 213 of b2dJson.cpp case b2Shape::e_edge: { b2EdgeShape* edge = (b2EdgeShape*)shape; vecToJson("vertex1", edge->m_vertex1, fixtureValue["edge"]); vecToJson("vertex2", edge->m_vertex2, fixtureValue["edge"]); if ( edge->m_hasVertex0 ) fixtureValue["edge"]["hasVertex0"] = true; if ( edge->m_hasVertex3 ) fixtureValue["edge"]["hasVertex3"]…
#include "PhysicsEdgeActor.h"
PhysicsEdgeActor::PhysicsEdgeActor(void)
{
this->_shapeType = SHAPETYPE_EDGE;
this->_edge = b2EdgeShape();
PhysicsActor::SetShapeType(SHAPETYPE_EDGE);
}
@musicm122
musicm122 / RubeLoader.cpp
Created September 25, 2013 01:35
Rube json Loader for Angel2d. adapted from SFML example code example @ https://www.iforce2d.net/rube/?panel=loaders
#include "StdAfx.h"
#include "RubeLoader.h"
#include "rubestuff/b2dJsonImage_OpenGL.h"
using namespace std;
//--Comparer
bool compareImagesByRenderOrder_ascending(const b2dJsonImage_OpenGL* a, const b2dJsonImage_OpenGL* b)
{
return a->renderOrder < b->renderOrder;
@musicm122
musicm122 / Cell_Padding_and_Cell_Spacing
Created April 1, 2013 15:27
Cell_Padding_and_Cell_Spacing in css
.UserInputTable table {
width: 100%;
border: 0;
border-spacing:0;
border-collapse:collapse;
}
.UserInputTable table td, .UserInputTable table td {
padding:5;
}
@musicm122
musicm122 / Diagnostic Object Extensions
Created January 23, 2013 23:21
Diagnostic Object Extensions
public static class DiagnositcObjectExtensions
{
public static string ToDiagnosticInfoString(this IEnumerable items)
{
var retval = String.Empty;
if(items.Count()>0)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine(“—–BEGIN DIAGNOSTIC——-”);
@musicm122
musicm122 / gist:4612358
Last active December 11, 2015 14:09
Preforms a git checkout -- file on every file in current directory
#!/bin/bash
#Author: Terrance Smith
#musicm122.blogspot.com
#Optional Argument = n : no prompt
#currently will take a while on a large number of files
function print_files
{
for file in *
do echo $file
@musicm122
musicm122 / WebsCommit.bat
Created November 28, 2011 19:41
Generic bazar commit
@echo off
:: Preforms commit on Webs Directory
echo Starting Commit
echo bzr commit -m "Daily Commit for :%date%
cd C:\Webs\
bzr.exe commit -m "Daily Commit for : %date%"
pause
echo "Task Complete"
cd ..