Skip to content

Instantly share code, notes, and snippets.

View hjerpbakk's full-sized avatar
🌝
Full-stack TypeScript 

Runar Ovesen Hjerpbakk hjerpbakk

🌝
Full-stack TypeScript 
View GitHub Profile
@hjerpbakk
hjerpbakk / SaveConfiguration.cs
Created July 22, 2012 17:36
Save config before
var ConfigurationFileMap = new ExeConfigurationFileMap() { ExeConfigFilename = "My.config" };
var config = ConfigurationManager.OpenMappedExeConfiguration(ConfigurationFileMap, ConfigurationUserLevel.None);
if (config != null)
{
// do stuff
config.Save();
}
var ConfigurationFileMap = new ExeConfigurationFileMap() { ExeConfigFilename = "My.config" };
var config = ConfigurationManager.OpenMappedExeConfiguration(ConfigurationFileMap, ConfigurationUserLevel.None);
if (config != null)
{
// do stuff
config.Save();
// Format XML
XDocument configXml = XDocument.Load(configuration.FilePath);
configXml.Save(configuration.FilePath, SaveOptions.None);
@hjerpbakk
hjerpbakk / gist:3165964
Created July 23, 2012 20:13
ERROR LOADING MIXED MODE ASSEMBLY
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
<meta content='4;url=http://hjerpbakk.com/' http-equiv='refresh'/>
<meta content='NOINDEX, NOFOLLOW' name='ROBOTS'/>
if (pageName == "saving-configuration-in-c.html")
{
pageName = "saving-a-configuration-in-c.html";
}
<b:widget id='Blog55' locked='true' title='Blog Posts' type='Blog'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "item"'>
<b:loop values='data:posts' var='post'>
<script type='text/javascript'>
var timestamp = '<data:post.timestamp/>';
timestamp = timestamp.split('/');
timestamp = timestamp[2]+'/'+timestamp[0].replace(/^[0]+/g,"")+'/'+timestamp[1].replace(/^[0]+/g,"")+'/';
<!-- Dim the background, aka the blog -->
<div style='height:100%;
width:100%;
position:fixed;
left:0;
top:0;
z-index:1 !important;
background-color:black;
filter: alpha(opacity=75);
/* internet explorer */ -khtml-opacity: 0.75;
@hjerpbakk
hjerpbakk / Optimize SVG OS X service shell script.sh
Created August 9, 2012 17:00
Script to be used as an OS X service that optimizes .svg-files using the scour Python script From http://hjerpbakk.com/blog/2012/9/1/optimize-svg-images-for-retina-displays.html
for f in "$@"
do
if [ ${f: -4} == ".svg" -o ${f: -4} == ".SVG" ]
then
python /Applications/Utilities/scour/scour.py --enable-comment-stripping --create-groups --enable-id-stripping --shorten-ids --set-precision=5 --quiet --indent=none -i "$f" -o "$f 2"
mv "$f 2" "$f"
fi
done
@hjerpbakk
hjerpbakk / snippet.js
Created August 11, 2012 10:07 — forked from necolas/snippet.js
Optimised async loading of cross-domain scripts, added js.async=true
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
add = function(url, id) {
if (doc.getElementById(id)) {return;}
js = doc.createElement(script);
js.src = url;
js.async=true;
id && (js.id = id);
fjs.parentNode.insertBefore(js, fjs);
@hjerpbakk
hjerpbakk / .Net version.xml
Created August 19, 2012 11:34
Checking the .Net version in WiX
<Condition Message='.NET Framework 4.0 must be installed prior to installation of [ProductName].'>
MsiNetAssemblySupport >= "4.0"
</Condition>