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 / codemirror-extjs.js
Last active August 3, 2022 00:10
CodeMirror ExtJs
{
fieldLabel: 'Code Instance',
itemId: 'parentFld',
border: 1,
html: '<textarea></textarea>',
/* Overriding getValue function of the field to pull value from the codemirror text area*/
getValue: function (value) {
return this.getCodeMirror().getValue();
},
/*Overriding setValue function of the field to put the value in the code mirror window*/
@weeksdev
weeksdev / parsing_helps.cs
Last active August 29, 2015 14:12
Parsing
public class SubstringResponse {
public string Value { get; set; }
public int loc1 { get; set; }
public int loc2 { get; set; }
}
public static SubstringResponse Substring(this string source, string startPos, string endPos) {
return Substring(source, new List<string>() { startPos }, endPos);
}
public static SubstringResponse Substring(this string source, List<string> startPos, string endPos) {
--determine which queries are running
SELECT *
FROM sys.dm_exec_requests requests
WHERE requests.session_id > 50
ORDER BY total_elapsed_time DESC
SELECT requests.session_id,
requests.status,
requests.command,
requests.statement_start_offset,
@weeksdev
weeksdev / NetezzaGenerateExternal
Last active March 13, 2017 21:00
Netezza Generate External Command
CREATE EXTERNAL TABLE 'path/to/flat/file.dat'
USING ( delim ',' datestyle 'YMD' datedelim '-' REMOTESOURCE 'ODBC' requireQuotes true quotedvalue 'yes' LOGDIR 'path/to/log/directory/' nullvalue '') AS
SELECT *
FROM MonkeyPants
@weeksdev
weeksdev / index.html
Last active August 29, 2015 14:22
testing bl.ocks.org
<html>
<head>
</head>
<body>
<h1>This is a test page</h1>
</body>
</html>
@weeksdev
weeksdev / GitCommands.md
Created June 19, 2015 13:49
GitCommands

tell you some files changes

git status

now revert back to the head with the changes that weren't commited

git checkout path/to/file.txt

run git status again and make sure there is nothing left

@weeksdev
weeksdev / jsononpagetocsv.js
Created June 24, 2015 14:42
jsononpagetocsv
var displaynames = [];
var data = JSON.parse(document.body.getElementsByTagName('pre')[0].innerHTML).data;
data.forEach(function(item){
if('displayname' in item.Properties && item.Properties.displayname != null && item.Properties.displayname.length> 0){
var displayname = item.Properties.displayname[0];
displaynames.push([displayname]);
}
});
var csvContent = '';
function exportToCsv(filename, rows) {
//requires signal-js, crossroads, and hasher to work
crossroads.addRoute('order/{id}', function(id){
console.log(id);
});
function parseHash(newHash, oldHash) {
crossroads.parse(newHash);
}
hasher.initialized.add(parseHash); //parse initial hash
msbuild myproject.csproj /p:DeployOnBuild=true /p:PublishProfile=MyPublishProfile
@weeksdev
weeksdev / gist:106d6e18ce5f60097c9e
Last active August 29, 2015 14:27 — forked from cmandersen/gist:91d840db222c3df543c2
Setup nginx to redirect Google's _escaped_fragment_= request to a snapshots folder
# This should be inserted into the server {...} block.
# These lines rewrite the url to access the snapshots folder, or where ever you keep
# you prerendered pages (mainly used when working with pages rendered by JavaScript).
#
# example.com/?_escaped_fragment_= --> example.com/snapshots/index.html
# example.com/?_escaped_fragment_=/blog --> example.com/snapshots/blog.html
# example.com/?_escaped_fragment_=/blog/post --> example.com/snapshots/blog/post.html
# Captures URLs with any amount of levels (?_escaped_fragment_=/.../...)