This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nano = require('nano')('http://localhost:5984'); | |
var dbName = 'testdb'; | |
var testDb = nano.use(dbName); | |
nano.db.list(function(error, databases) { | |
if (error) | |
return console.log('ERROR :: nano.db.list - %s', JSON.stringify(error)); | |
if (databases.indexOf(dbName) < 0) { | |
nano.db.create(dbName, function(error, body, headers) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Express</title> | |
<link rel="stylesheet" href="/assets/bootstrap/css/bootstrap.css"> | |
<link rel="stylesheet" href="/stylesheets/style.css"> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script src="/assets/bootstrap/js/bootstrap.js"></script> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myNamespace = (function() { | |
// private functions for your namespace | |
var getSelText = function() { | |
... | |
}; | |
return { | |
run: function() { | |
var selectedText = getSelText(); | |
alert (selectedText); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
def printJsonData(filename): | |
file = open(filename) | |
jsonString = file.read() | |
jsonString = jsonString.replace('\'', '"') | |
#print(jsonString) | |
jsonObject = json.loads(jsonString) | |
print(jsonObject['Namespace'] , '|', jsonObject['ProcPrefix']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Found on http://ejohn.org/blog/learning-from-twitter/ | |
- neat way for performant JS when needing to bind on window scroll | |
*/ | |
var outerPane = $details.find(".details-pane-outer"), | |
didScroll = false; | |
$(window).scroll(function() { | |
didScroll = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @StartDate = CONVERT(DATETIME, CONVERT(VARCHAR, MONTH(@StartDate)) + '/1/' + CONVERT(VARCHAR, YEAR(@StartDate))); | |
-- get a table of all of the month ends between @startDate and @endDate | |
CREATE TABLE #MonthEnds ( | |
MonthEnd DATETIME | |
); | |
INSERT INTO #MonthEnds (MonthEnd) | |
SELECT TOP (DATEDIFF(MONTH, @StartDate, @EndDate)+1) | |
DATEADD( | |
DAY, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// lifted from http://stackoverflow.com/a/10130176/4040187 | |
public class StringPropertyTruncateSpecimenBuilder<TEntity> : ISpecimenBuilder | |
{ | |
private readonly int _length; | |
private readonly PropertyInfo _prop; | |
public StringPropertyTruncateSpecimenBuilder(Expression<Func<TEntity, string>> getter, int length) | |
{ | |
_length = length; | |
_prop = (PropertyInfo)((MemberExpression)getter.Body).Member; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I'm not sure if this is the best or most correct way to do it, but it seems to work in my prototype. | |
// Basically, I want "dependency injection" for my controller, and after reading some tech blogs online, | |
// it seems like the best way to do this is to use IHttpControllerActivator to inject dependencies into | |
// your controller because you will have context of the request doing it this way as opposed to doing it | |
// via traditional dependency injection. | |
// this code in Global.asax.cs | |
public WebApiApplication() | |
{ | |
this.container = new UnityContainer(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$targDir = "C:\dev\LMS-client-ADA"; | |
Get-ChildItem $targDir -Filter *.pdf | | |
Foreach-Object { | |
$oldname = $_.FullName; | |
$newname = $_.FullName.Replace(" ", "_"); | |
$newname = $newname -replace "[0-9]+\-[0-9]+\-[0-9]+_", ""; | |
Rename-Item $oldname $newname; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$targDir = "C:\inetpub\websites\ADA*\"; | |
$subDir = $(Get-ChildItem "$targDir"); | |
foreach($sub in $subDir) { | |
$files = $(Get-Childitem $sub -Filter app_offline*.htm); | |
foreach($file in $files) { | |
$oldname = $file.FullName; |
OlderNewer