Skip to content

Instantly share code, notes, and snippets.

View josephbales's full-sized avatar

Joseph Bales josephbales

View GitHub Profile
@josephbales
josephbales / trim_db_cols.sql
Last active September 19, 2016 18:49
Trim all columns in a database T-SQL
-- Replace <DATABASE> with the name of your database
-- May also need to change the DATA_TYPE inside the cursor to fit your schema
DECLARE @TABLENAME NVARCHAR(255)
DECLARE @SQL NVARCHAR(MAX)
DECLARE db_cursor CURSOR FOR
SELECT TABLE_NAME
FROM <DATABASE>.INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'
<!DOCTYPE html>
<html>
<head>
<title>Test File</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.green-blue.min.css">
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<!DOCTYPE html>
<html>
<head>
<title>Test File</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.green-blue.min.css">
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
@josephbales
josephbales / transform.xsl
Created January 14, 2016 22:01
XSLT to convert Wordpress RSS feed to HTML
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<xsl:output omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="channel">
@josephbales
josephbales / gist:0d2560e8487a5b882fd2
Last active January 11, 2016 19:38
Material design test
<!DOCTYPE html>
<html>
<head>
<title>Test File</title>
<link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.green-blue.min.css">
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<!-- Uses a transparent header that draws on top of the layout's background -->
<style>
@josephbales
josephbales / LAMP_SETUP_OLD.md
Created October 16, 2015 21:09
How to set up a LAMP stack in VIrtualBox... old instructions.

#Setting Up a Development LAMP Stack: ##Using Windows, VirtualBox, and Ubuntu

This document describes how to set up a development LAMP stack using a host Windows machine, VirtualBox, and Ubuntu Server 12.04.

###Step 1: Setting up the host machine

  • Create a shared folder on the host machine. This can be anywhere. I placed mine in my documents folder.
  • Edit your hosts file as Administrator
    • Right click on Notepad or your editor of choice and select Run as Administrator
  • On Windows navigate to C:\Windows\System32\drivers\etc and open the hosts file
@josephbales
josephbales / gist:b2f6d4b93113b6ae5ec5
Created September 15, 2015 23:01
Code that gets malformed dates from a from an ObdcDataReader
while (reader.Read())
{
string line = "";
for (int i = 0; i < fCount; i++)
{
try
{
line = line + reader[i].ToString().Trim().Replace("\n", "").Replace("\r", " ") + "\t";
}
@josephbales
josephbales / App.java
Last active August 29, 2015 14:25
Getting Gist contents via Java
package com.josephbales.test1.testapp1;
/*
* Github libraries available through Maven
* Or here: https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core
*/
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import org.eclipse.egit.github.core.*;
<p>This one tests titles.</p>
@josephbales
josephbales / TextProcessing1
Created March 29, 2015 15:55
Takes a file, splits it into chunks of 8 lines, orders the chunks of 8 lines into a tab delimited string, writes to file
$inputfile = "Week"
$outputfile = "plan.txt"
Out-File $outputfile
$input = Get-Content $inputfile
$i = 0
$l = $input.Length