Skip to content

Instantly share code, notes, and snippets.

View JeremyMorgan's full-sized avatar

Jeremy Morgan JeremyMorgan

View GitHub Profile
@JeremyMorgan
JeremyMorgan / contact.js
Created March 19, 2014 17:02
JavaScript for multi submit form
$( document ).ready(function() {
drawform();
function drawform() {
$( "#inputgroup" ).append( "<div class=\"control-group\">\
<label class=\"control-label\" for=\"textinput[]\">Text Input</label>\
<div class=\"controls\">\
<input id=\"textinput\" name=\"textinput[]\" type=\"text\" placeholder=\"placeholder\" class=\"input-xlarge\">\
@JeremyMorgan
JeremyMorgan / cluster.php
Last active August 29, 2015 13:57
Bad Habits - Cluster
<?php
// why this is bad
$querycount = "SELECT * FROM $table WHERE Email_Date is null AND DESCRIPTION = 'LIST NAME'";
$query = sqlsrv_query($link, "SELECT * FROM $table WHERE Email_Date is not null AND DESCRIPTION = 'LIST NAME' ORDER BY Email_date DESC");
$qcount = sqlsrv_query($link,$querycount);
$date = date('Y-m-d');
while($row = sqlsrv_fetch_array($qcount)){
$esr[] = $row[$emailnum];
}
$max_days = 0;
@JeremyMorgan
JeremyMorgan / arrayview.php
Created April 16, 2014 22:38
Throw array contents into page source - Debugging
echo "<pre><!--";
print_r($key);
echo "--></pre>";
@JeremyMorgan
JeremyMorgan / Test.go
Created April 25, 2014 22:42
Something to do a bunch of calculations in golang
package main
import "fmt"
func GetRadius(n int) {
var pi float64 = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609
for i := 0; i < 1000; i++ {
fmt.Println(n, ":", (float64(i) * float64(i)) * pi)
@JeremyMorgan
JeremyMorgan / ContactController.cs
Created April 28, 2014 22:44
Contact Controller - Win API
public HttpResponseMessage Post([FromBody] PostObject ourPostObject)
{
try
{
// Debug.WriteLine(ourPostObject.testValue);
// post object
Mailer ourMailer = new Mailer();
try
{
ourMailer.sendEmail(ourPostObject.recipient, ourPostObject.subject, ourPostObject.message);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success" message:@"You reached your goal!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
@JeremyMorgan
JeremyMorgan / nokeyboard.m
Created May 7, 2014 07:23
Make Keyboard dissapear
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
[self.view endEditing:TRUE];
}
@JeremyMorgan
JeremyMorgan / recpalcheck.php
Last active August 29, 2015 14:03
Check if a string is palindrome recursively
<?php
// check if a string is a palindrome from the command line
$inputstring = $argv[1];
function isPalindrome($inputstring)
{
if (strlen($inputstring) <= 1){
// if there is only one or zero characters, technically it's a palindrome
return true;
@JeremyMorgan
JeremyMorgan / wccca.cs
Created October 7, 2014 20:05
Call Scraper
using System;
using System.ComponentModel;
using HtmlAgilityPack;
using System.Linq;
using System.IO;
using System.Collections.Generic;
public class Test {
public static void Main(){
@JeremyMorgan
JeremyMorgan / helloworld.cbl
Created October 15, 2014 19:23
Hello world cobol
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello world!'.
STOP RUN.