Skip to content

Instantly share code, notes, and snippets.

View TRex22's full-sized avatar
🎮
Life

Jason Chalom TRex22

🎮
Life
View GitHub Profile
#!/usr/bin/perl
#fetch Gravatars
use strict;
use warnings;
use LWP::Simple;
use Digest::MD5 qw(md5_hex);
my $size = 90;
@TRex22
TRex22 / base.js
Created January 6, 2015 14:19
AngularJS Base Controller and page timeout query string
//ref: http://jasonwatmore.com/post/2014/03/25/AngularJS-A-better-way-to-implement-a-base-controller.aspx
//base.js
(function() {
var base = angular.module('base', []);
base.controller('BaseCtrl', function($scope, $location, $timeout, $route) {
var queryStr = $location.search();
if(queryStr.timeout){
var timeoutLengthSec = (queryStr.timeout) * (1000);
$timeout(function(){
$route.reload();
@TRex22
TRex22 / gist:c29df184ba6016ae1e31
Created January 6, 2015 14:23
Code from StackOverflow to pull out url query strings in pure JavaScript
//http://stackoverflow.com/questions/11582512/how-to-get-url-parameters-with-javascript/11582513#11582513
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [,""])[1].replace(/\+/g, '%20')) || null;
}
@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);
@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 / 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 / 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 / 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 / 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 / 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);