Skip to content

Instantly share code, notes, and snippets.

View TRex22's full-sized avatar
🎮
Life

Jason Chalom TRex22

🎮
Life
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDbWrapper;
namespace MongoDbExampleDataGenerator
public async void DoLogic()
{
BsonDocument document;
Console.WriteLine("This program will generate some data when option A is selected.");
Console.WriteLine("Option B will find some data.");
Console.WriteLine("Option C (any other input) will display data from database.");
var input = Console.ReadLine();
public async Task<string> CreateDocument(string collectionName, BsonDocument document)
{
string message = "nothing has happened";
var collection = _mongoDatabase.GetCollection<BsonDocument>(collectionName);
//insert collection
await collection.InsertOneAsync(document);
message = "updated data";
return message;
}
@TRex22
TRex22 / GJ.m
Created May 12, 2015 07:49
Gauss Jordan
%Guassian_Elimination with jordan method
%This is my code Jason Chalom 711985
%[r, c] = size(A);
%A = [2 -1 2 1; 1 1 2 1; 2 1 5 3];
% a has both a matrix and b vector
function [output] = Guassian_Elimination_Jordan (a, b)
%do gauss first
a= horzcat(a,b);
[r,c] = size(a);
@TRex22
TRex22 / SuperClean.cmd
Created March 21, 2015 21:01
SuperClean VS 2013 Build Folder Clean Script
@echo off
echo A cleaning script for .NET MSBuild compiled folders - Jason Chalom 2015
echo This will delete all bin and obj folders
echo Beware!!
echo
echo First MSBUILD CLEAN will be activated.
echo Will use the location for VS 2013 MS Build Tools 32 bit X86
pause
"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" /t:clean
echo not implemented yet
@TRex22
TRex22 / objToHtmlList.js
Last active August 29, 2015 14:14
objToHtmlList
//from stackoverflow somewhere
function jsonToHtmlList(json) {
return objToHtmlList(JSON.parse(json));
}
function objToHtmlList(obj) {
if (obj instanceof Array) {
var ol = document.createElement('ol');
for (var child in obj) {
@TRex22
TRex22 / index.cshtml
Created January 29, 2015 11:59
Show a modal and pass information into it
column.For(x => x.UserAchievementMappingGroup == null ? string.Empty : string.Format("<input type=\"button\" data-command=\"displayAchievementAditonalInfoModal\"/><span class=\"hide\">{0}</span>", x.AchievementTransaction.AdditionalInformation)
).Sortable(false).Named("Additional Information")
.Encode(false).Attributes(@class => "additional-column").HeaderAttributes(@class => "additional-column");
@TRex22
TRex22 / JSONtoHTML.js
Last active August 29, 2015 14:14
Convert JSON to HTML via Javascript and JQuery
//FROM: http://stackoverflow.com/questions/8324239/generating-html-from-arbitrarily-complex-json-object-in-javascript
jQuery(function($) {
display("Loading the JSON data");
$.ajax({
type: "GET",
url: "/path/to/the/data",
dataType: "JSON",
success: function(data) {
display("Got the data, rendering it.");
@TRex22
TRex22 / largeNumberFormatter.js
Last active August 29, 2015 14:13
A Large Number Formatter
var formatLargeNumbers = function (maxNumberToDisplay, maxPlaces, forcePlaces, forceLetter, forceToolTip) {
$(document).ready(function () {
applyFormatting();
});
function applyFormatting() {
$(".large-number-format").each(function() {
var number = $(this).html();
@TRex22
TRex22 / gist:3f25ae3139863f2deb7c
Last active August 29, 2015 14:13
Sql Server WHERE to get only transactions from today (date) from utc column
SELECT *
FROM db
WHERE DateRequested >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0);