Skip to content

Instantly share code, notes, and snippets.

View juristr's full-sized avatar

Juri Strumpflohner juristr

View GitHub Profile
@juristr
juristr / upgradewebapi.md
Last active August 29, 2015 13:56
Upgrade Gist

Upgrade WebApi beta to latest

Upgrading through the NuGet package manager is a pain

Therefore, I followed these steps

Create a new WebApi template project

@juristr
juristr / hidenavbar.js
Created December 23, 2013 20:41
This script hides the navbar '.js-navbar' when scrolling downwards on a page and shows it again when scrolling upwards. Used this on my blog for articles and hiding the top-navbar.
/*
This script hides the navbar '.js-navbar'
when scrolling downwards on a page and shows it again
when scrolling upwards
*/
$(function(){
var $nav = $('.js-navbar'),
_hideShowOffset = 20,
_lastScroll = 0,
_detachPoint = 50;
@juristr
juristr / modelevent.js
Created September 19, 2013 07:20
jmvc model events
// 1st param is the class, 2nd the jQuery.Event and 3rd the actual instance containing the data
"{Pensplan.Models.Member} updated": function (Member, ev, memberInstance) {
...
}
@juristr
juristr / validation.html
Created September 18, 2013 11:58
Validation error messages with Bootstrap 3
<div class="col-md-2 form-group has-error">
<label class="mandatory control-label" for="txtResidenceCAP">[lblResidenceCAP]<abbr>(*)</abbr></label>
<input class="form-control" type="text" id="txtResidenceCAP" name="residenceCap" value="38025" placeholder="[phResidenceCAP]">
<span for="txtResidenceCAP" generated="true" class="help-block" style="display: inline;">Value required!</span>
</div>
@juristr
juristr / Gruntfile.js
Last active December 23, 2015 07:18
Grunt development server
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.initConfig({
connect: {
server: {
options: {
port: 8000,
base: '.',
@juristr
juristr / Nuget Resync packages
Created September 16, 2013 06:49
Synchronize NuGet with VS project references
function Sync-References([string]$PackageId) {
get-project -all | %{
$proj = $_ ;
Write-Host $proj.name;
get-package -project $proj.name | ? { $_.id -match $PackageId } | % {
Write-Host $_.id;
uninstall-package -projectname $proj.name -id $_.id -version $_.version -RemoveDependencies -force ;
install-package -projectname $proj.name -id $_.id -version $_.version
}
}
@juristr
juristr / git-cheat-sheet.md
Last active July 17, 2023 20:33
My Git cheat sheet

Git Cheat Sheet

Committing and Undoing

Adding file for committing

$ git add <filename>
@juristr
juristr / prettyprint_sunburst.css
Created March 2, 2013 23:24
CSS style for prettyprint sunburst style. More nice themes for prettyprint can be found here: http://demo.stanleyhlng.com/prettify-js/?id=tomorrow-night-dark
/* Pretty printing styles. Used with prettify.js. */
/* Vim sunburst theme by David Leibovic */
pre .str, code .str { color: #65B042; } /* string - green */
pre .kwd, code .kwd { color: #E28964; } /* keyword - dark pink */
pre .com, code .com { color: #AEAEAE; font-style: italic; } /* comment - gray */
pre .typ, code .typ { color: #89bdff; } /* type - light blue */
pre .lit, code .lit { color: #3387CC; } /* literal - blue */
pre .pun, code .pun { color: #fff; } /* punctuation - white */
pre .pln, code .pln { color: #fff; } /* plaintext - white */
@juristr
juristr / HttpContextMock.cs
Created February 19, 2013 13:54
Mock HttpContext class
IIdentity identity = new GenericIdentity(AccoDAOTest.userADNamePresentInDB);
IPrincipal currentUser = new GenericPrincipal(identity, null);
TextWriter tw = new StringWriter();
HttpWorkerRequest wr = new SimpleWorkerRequest("/webapp", "c:\\inetpub\\wwwroot\\webapp\\", "default.aspx", "", tw);
HttpContext.Current = new HttpContext(wr);