Skip to content

Instantly share code, notes, and snippets.

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

Andrew Weeks weeksdev

🏠
Working from home
View GitHub Profile
@weeksdev
weeksdev / storeLoad.js
Created January 9, 2014 18:59
ExtJS: Getting Other Data from Store Load
Ext.define('app.store.Reviews', {
extend: 'Ext.data.Store',
model: 'app.model.Review',
pageSize: 200,
remoteSort: true,
// allow the grid to interact with the paging scroller by buffering
buffered: true,
proxy: {
type: 'ajax',
url: 'review/list',
@weeksdev
weeksdev / UploadFileAsmx.cs
Created January 21, 2014 16:33
Upload File with Asmx
[WebMethod]
public void UploadFile()
{
try
{
//HTTP Context to get access to the submitted data
HttpContext postedContext = HttpContext.Current;
//File Collection that was submitted with posted data
HttpFileCollection Files = postedContext.Request.Files;
@weeksdev
weeksdev / commands.md
Last active March 9, 2016 15:19
Basic Git Commands

###Read This http://rogerdudler.github.io/git-guide/

###Only Run First Time git config --global user.name "BLAH"
git config --global user.email "BLAH@BLAH.com"
git init

###Run Everytime git add -A

@weeksdev
weeksdev / LDAP Queries
Last active August 29, 2015 13:56
LDAP Queries
(&(&(objectclass=*)(objectcategory=*))((cn=Hello World*)))
(&(&(objectclass=*)(objectcategory=*))((memberOf=)))
@weeksdev
weeksdev / npoi.cs
Created March 5, 2014 22:00
NPOI Excel Workbook Creation From Web Service
[WebMethod]
public void WriteExcelWorkbook(List<DataTable> dataTables, List<string> worksheetNames, string workbookName = "file", bool includeHeaders = true)
{
NPOI.HSSF.UserModel.HSSFWorkbook wb = new NPOI.HSSF.UserModel.HSSFWorkbook();
//create bold font for headers
var font = wb.CreateFont();
font.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold;
List<string> usedNames = new List<string>();
for (var xTable = 0; xTable < dataTables.Count; xTable++)
@weeksdev
weeksdev / regexJSTest.js
Created April 21, 2014 15:39
Javascript RegEx Test
var myString = "CN=BlamoMan,OU=Associates,DC=prod-am,DC=ameritrade,DC=com";
var myRegexp = /CN=(.*?),[A-Z]/g;
var match = myRegexp.exec(myString);
if(match){
alert(match[1].replace(/\\/,''));
}
@weeksdev
weeksdev / ghost
Created April 29, 2014 20:58
GHOSTSCRIPT PDF Security Removal
gswin64c -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sFONTPATH=%windir%/fonts;xfonts;. -sPDFPassword= -dPDFSETTINGS=/prepress -dPassThroughJPEGImages=true -sOutputFile=C:\GHOSTSCRIPT\BOOMER.GHOST.pdf C:\GHOSTSCRIPT\BOOMER.pdf
@weeksdev
weeksdev / beatles.json
Created May 18, 2014 13:31
Beatles Json
[
{
"firstName":"Paul",
"lastName":"McCartney",
"instrument":"Lead Vocalist"
},
{
"firstName":"John",
"lastName":"Lennon",
"instrument":"Guitar"
@weeksdev
weeksdev / regexparse.bas
Created May 29, 2014 13:45
RegEx Parse
Sub RegExParse()
Dim RE As Object, REMatches As Object
Dim pattern As String
Set RE = CreateObject("vbscript.regexp")
pattern = "\[(.*?)\] \["
With RE
.MultiLine = False
.Global = False
@weeksdev
weeksdev / bulkcopy.cs
Created May 29, 2014 19:04
SqlBulkCopy
var copy = new System.Data.SqlClient.SqlBulkCopy(connectionString);
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand("select * from someTable",connection);
var reader = command.ExecuteReader();
copy.DestinationTableName = "destinationTable";
copy.WriteToServer(reader);
copy.Close();
connection.Close();