Skip to content

Instantly share code, notes, and snippets.

@damirarh
damirarh / SetWinStoreSetting.ps1
Created January 17, 2015 15:14
Function for changing a windows Store app setting directly in its settings.app file
function Set-WinStoreSetting {
param (
[Parameter(Mandatory=$true, Position=0)][string]$PackageName,
[Parameter(Mandatory=$true, Position=1)][string]$SettingName,
[Parameter(Mandatory=$true, Position=2)][string]$SettingValue
)
$settingsFile = [IO.Path]::Combine($env:LOCALAPPDATA, 'Packages', $PackageName, 'Settings\settings.dat')
# temporary paths
@bertmuthalaly
bertmuthalaly / gist:bb932fb93e22fe6260b2
Last active July 12, 2020 06:43
rich-hickey-mastery
Rich Hickey on becoming a better developer
Avatar
Rich Hickey • 3 years ago
Sorry, I have to disagree with the entire premise here.
A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.
Mastery comes from a combination of at least several of the following:
@staltz
staltz / introrx.md
Last active October 26, 2025 03:06
The introduction to Reactive Programming you've been missing
import System.Directory
import System.Environment
import System.FilePath
import Control.Applicative ((<$>))
import Control.Arrow (first, second)
import Control.Monad (void)
import Data.Either (rights)
import Data.List (isSuffixOf)
import Data.Set (Set, (\\), empty, fromList, insert, singleton, toList, union)
import Text.Parsec
@Daniel15
Daniel15 / gist:11127778
Created April 20, 2014 23:18
ILMerge from MSBuild

Install ILMerge from NuGet Set assembly name to "Blah.original.dll"

Set Post-build event command line to:

"$(SolutionDir)packages\ilmerge.2.13.0307\ilmerge.exe" /keyfile:"$(SolutionDir)Key.snk" /out:"$(TargetDir)$(ProjectName).dll" "$(TargetPath)" "$(SolutionDir)lib\foo.dll" "$(SolutionDir)lib\bar.dll"

This will generate a "Blah.dll" with foo.dll and bar.dll merged into it.

@CrabDude
CrabDude / callback_contract.md
Last active December 20, 2019 18:50
Node.js Callback Contract

Node.js Callback* Contract

(aka "errback" or "error first callback")

  1. Function that takes 2 arguments
    • first argument is an error
    • second argument is the result
    • Never pass both
    • error should be instanceof Error
  2. Must never excecute on the same tick of the event loop
  3. Must be passed as last argument to function
@berkus
berkus / CMakeLists.txt
Created April 3, 2014 13:52
Competition winner from Twitter image encoding challenge - http://stackoverflow.com/questions/891643/twitter-image-encoding-challenge
CMAKE_MINIMUM_REQUIRED( VERSION 2.4 )
PROJECT( nanocrunch )
ADD_EXECUTABLE( nanocrunch nanocrunch.cpp )
INCLUDE( FindImageMagick )
FIND_PACKAGE( ImageMagick COMPONENTS Magick++ )
IF( ImageMagick_FOUND )
INCLUDE_DIRECTORIES( ${ImageMagick_INCLUDE_DIRS} )
TARGET_LINK_LIBRARIES( nanocrunch ${ImageMagick_LIBRARIES} )
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index b78e9f5..f6aa264 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -1200,8 +1200,11 @@ unsigned SourceManager::getPresumedColumnNumber(SourceLocation Loc,
if (isInvalid(Loc, Invalid)) return 0;
return getPresumedLoc(Loc).getColumn();
}
-
-#ifdef __SSE2__

Effective ML (and F#)

24 Jun 2012

This is a summary of Yaron Minsky’s nine pieces of advice from the Effective ML video. Since ML is a predecessor of F#, most of the advice applies to F# as well.


Favor readers over writers (10:20). There’re systematic differences in opinion between those who spent their time reading code and those who spent it writing code. Whenever there’s a difference in opinion between these two groups, the readers are always right and the writers are always wrong. The readers will always push in the direction of clarity and simplicity and the ability to change behavior easily. At least if you’re building software that’s going to last.

@t-mat
t-mat / win32-range-based-find-first-file.cpp
Last active January 2, 2016 23:29
Win32, C++11: FindFirstFile() iterator for range-based for
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <locale.h>
template<class> struct FindFilesData {};
template<> struct FindFilesData<char> { using Type = WIN32_FIND_DATAA; };
template<> struct FindFilesData<wchar_t> { using Type = WIN32_FIND_DATAW; };