Don't use this gist anymore. It has been upgraded to a full github repository
This file contains 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
$tempDir = ([system.io.path]::GetTempPath()) | |
Import-Module pscx 2>$null | |
$Pscx:Preferences['TextEditor'] = 'C:\Program Files\Sublime Text 3\subl.exe' | |
set-alias edit Edit-File -Scope Global | |
Set-Alias vim 'C:\Program Files (x86)\vim\vim74\vim.exe' | |
Set-Alias vi vim | |
Import-Module z | |
#if(-not $env:OwPassword) { |
This file contains 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
define( | |
['_underscore', 'jquery'], | |
function underscoreExtensions(_, $){ | |
//Object and collection helpers | |
_.mixin({ | |
// Create object from a callback that returns [name, value] pairs. We use this combination a lot | |
// so might as well bake it into the framework | |
mapObject: _.compose(_.object, _.map) |
This file contains 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
W:\temp> npm install node-stringprep | |
npm http GET https://registry.npmjs.org/node-stringprep | |
npm http 304 https://registry.npmjs.org/node-stringprep | |
npm http GET https://registry.npmjs.org/nan | |
npm http GET https://registry.npmjs.org/bindings | |
npm http 304 https://registry.npmjs.org/bindings | |
npm http 304 https://registry.npmjs.org/nan | |
> node-stringprep@0.5.2 install W:\temp\node_modules\node-stringprep | |
> node-gyp rebuild |
This file contains 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
app.SimpleAuthorization("/Admin/SimpleTableEditor/France/UserPermissions", (owinEnvironment) => | |
Ogre.RoleConfiguration.GetRolesForUser(owinEnvironment["username"].ToString()).Contains("Editor")) | |
//^ Not exactly sure how to do Authorization. Should probably go in its own Nuget package? | |
// My idea is basically just for any request to that route run the lambda, and 401 if it returns false. | |
app.UseSimpleTableEditor(new SimpleTableEditorOptions { | |
Url = "/Admin/SimpleTableEditor/France/UserPermissions", | |
Label = "France - User Permissions", | |
ConnectionString: x => x.ConnectionString( OgreDeployment.ConnectionString("frenchDatamart") ), //Nested closure rather than just interface to make it easier to find | |
//^ or x => x.ConnectionStringName("frenchDatamart") which will pluck the value out of ConfigurationManager |
This file contains 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
public class Presentation | |
{ | |
public class PackageResult | |
{ | |
public string Name; | |
public Stream Stream; | |
} | |
//PackageResult as an inner clas can be a good idea since its really just a Tuple and has no reusability value | |
public PackageResult Package() | |
{ |
This file contains 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
$tokens = cat .\facebook-tokens.csv | |
pushd | |
$wc = New-Object Net.WebClient | |
mkdir infos | |
cd infos | |
$cntr = 0 | |
foreach($t in $tokens) { | |
$cntr += 1 |
This file contains 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> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
#code { | |
position: relative; | |
transition: all 1s ease; |
This file contains 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
using System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using System.Text.RegularExpressions; | |
using System.Threading.Tasks; | |
namespace System | |
{ | |
public static class ObjectExtensions | |
{ |
It works something like this when your db context is injected (and you use AutoMapper)
public IEnumerable<MainScreenSlideDefinition> Get(string type) {
return db.SlideDefinition.Where(s => s.Type == type).ToList().Select(s => Mapper.Map<MainScreenSlideDefinition>(s));
}
or like this if it is not
OlderNewer