Skip to content

Instantly share code, notes, and snippets.

View hanssens's full-sized avatar

Juliën Hanssens hanssens

View GitHub Profile
@hanssens
hanssens / ListAllPropertyNamesAndValues.cs
Last active August 29, 2015 14:08
List all property names and values with reflection
/// <summary>
/// Iterates through each and every property for the specified object and lists its value, including nulls.
/// </summary>
static void ListAllPropertyNamesAndValues(object obj)
{
var t = obj.GetType();
var properties = t.GetProperties();
foreach (var prop in properties)
{
@hanssens
hanssens / read-local-file-or-fetch-from-remote.js
Created September 4, 2014 12:41
Cordova/Phonegap - Reads a (json) file from the local cache and fetches it from a remote url if it doesn't exist yet
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@hanssens
hanssens / globals.js
Created August 19, 2014 12:36
Globals.js - Provides generic global functions, helpers and extensions.
/*
* Globals.js - Provides generic global functions, helpers and extensions.
*/
/*
* Function: isNullOrEmpty()
* @value: determines if the object is null, empty or undefined.
*/
function isNullOrEmpty(value) {
return (value == null || value == "" || value == "undefined");
@hanssens
hanssens / SearchAllTables.sql
Created June 25, 2014 07:46
T-SQL Stored Procedure to search all columns of all tables for a given search string
CREATE PROC SearchAllTables
(
@SearchStr nvarchar(100)
)
AS
BEGIN
-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
-- Purpose: To search all columns of all tables for a given search string
-- Written by: Narayana Vyas Kondreddi
@hanssens
hanssens / PrototypeBootstrap.js
Created June 25, 2014 07:44
Simple Javascript Prototype sample, used for quick copy/paste...
// Simple Javascript Prototype sample, used for bootstrapping classes ;)
var App = function() {
// define a custom function 'Ping()'
App.prototype.Ping = function () {
console.log("Pong!");
};
};
@hanssens
hanssens / prettify.hanssens.css
Created June 9, 2014 18:56
Hanssens.com' custom Prettify Code Syntax
/* Based on Twitter Bootstrap style http://twitter.github.com/bootstrap/ */
.prettyprint .com { color: #93a1a1; }
.prettyprint .lit { color: #195f91; }
.prettyprint .pun, .prettyprint .opn, .prettyprint .clo { color: #93a1a1; }
.prettyprint .fun { color: #dc322f; }
.prettyprint .str, .prettyprint .atv { color: #D14; }
.prettyprint .kwd, .prettyprint .linenums .tag { color: #1e347b; }
.prettyprint .typ, .prettyprint .atn, .prettyprint .dec, .prettyprint .var { color: teal; }
.prettyprint .pln { color: #48484c; }
@hanssens
hanssens / LocalDB Reset
Created March 25, 2014 10:02
Reset SQL's LocalDB, after corrupt rights or other problems.
# After problems with a company-wide ActiveDirectory shaker, all (local) SQL Server instances were FUBAR.
# This 'resets' the LocalDB sql instance.
sqllocaldb stop "v11.0" -k
sqllocaldb delete "v11.0"
sqllocaldb create "v11.0"
sqllocaldb start "v11.0"
@hanssens
hanssens / C# Template
Last active August 29, 2015 13:56 — forked from adambyram/C# Template
C# build template for CodeRunner on OSX
using System;
using System.Collections.Generic;
using System.Linq;
namespace CodeRunnerCSharp
{
class Program
{
public static void Main (string[] args)
{
@hanssens
hanssens / show-hidden-files-osx.txt
Last active April 22, 2022 00:53
Show all system files, incl. .gitignore, in OSX.
Show all hidden files
> defaults write com.apple.finder AppleShowAllFiles TRUE
Hide all hidden files
> defaults write com.apple.finder AppleShowAllFiles FALSE
In both actions, Finder needs to be restarted through:
> killall Finder
@hanssens
hanssens / gist:8182406
Created December 30, 2013 14:03
Fix for the UnauthorizedAccessException in Xamarin Studio (MonoDevelop) when running a MVC 4/5 website on Mac OSX.

Fix for the UnauthorizedAccessException in Xamarin Studio

This is a fix for the UnauthorizedAccessException in Xamarin Studio (MonoDevelop) when running a MVC 4/5 website on Mac OSX.

The error:

System.UnauthorizedAccessException
Access to the path "/Library/Frameworks/Mono.framework/Versions/3.2.5/etc/mono/registry" is denied.