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
$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' | |
Set-ItemProperty $key LaunchTo 1 # Open File Explorer to "This PC" (not "Quick access") | |
Set-ItemProperty $key Hidden 1 # Hidden files and folders set to "Show hidden files, folder and drives" | |
Set-ItemProperty $key HideFileExt 0 # Unckeck Hide extensions for known file types | |
Set-ItemProperty $key ShowSuperHidden 1 # Unckeck Hide protected operting system files | |
Set-ItemProperty $key TaskbarGlomLevel 1 # Combine taskbar buttons when taskbar is full | |
Stop-Process -processname explorer # restart Explorer to apply changes |
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
namespace MyProject.Models | |
{ | |
public class MyModel // class: PascalCase | |
{ | |
private readonly string _myField; // private field: _camelCaseWithPrefix | |
public MyModel(string defaultFieldValue) // param: camelCase | |
{ | |
_myField = defaultFieldValue; | |
} | |
public string MyProperty => _myField; // property: PascalCase |
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; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
namespace SomeProject | |
{ | |
public static class IQueryableExtensions | |
{ | |
public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> source, string ordering, bool desc = false) |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace SomeProject | |
{ | |
public class ListOptions | |
{ | |
public ListOptions() : this(PageSizeValue.Default) { } | |
public ListOptions(PageSizeValue pageSize) : this(pageSize.AsInt32()) { } |
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; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.Security.Claims; | |
using Microsoft.AspNetCore.Authentication; | |
using Microsoft.AspNetCore.Authentication.OAuth; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.DependencyInjection; | |
using Newtonsoft.Json.Linq; |
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
#!/bin/sh | |
#source "$(git --exec-path)/git-sh-setup" | |
targetBranch="$1" | |
# get current branch to return to it | |
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') | |
# if current branch is target | |
if [ "$branch" = "$targetBranch" ]; then | |
if [ "--force" != "$2" ]; then | |
echo "Error: you try to recheckout current branch. Use --force" | |
exit 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
node -e "require('http').createServer((req, res)=>res.write('Hello World',()=>res.end())).listen(3000);" |
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
CERTS_PATH="/path/to/certs" | |
HOST="my.example.com" | |
EMAIL="email@example.com" | |
DOCKER_SOCK="/var/run/docker.sock" | |
docker run \ | |
--name nginx-proxy \ | |
--detach=true \ | |
--publish 80:80 \ | |
--publish 443:443 \ |
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
const moo = require('moo'); | |
const Time = require('./time'); | |
const parser = moo.compile({ | |
VAR: { | |
match: /{[a-zA-Z_]\w*}/, | |
keywords: { PREDEF: ['{today}'] } // predefined keywords | |
}, | |
OP: ['and', 'or', '+', 'at'], | |
DAY: { |
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
// nodejs v8.9.4 | |
// yarn add evernote@2.0.5 | |
const Evernote = require('evernote'); | |
const client = new Evernote.Client({ token: 'put-your-token-here', sandbox: false }); | |
const store = client.getNoteStore(); | |
process.on('uncaughtException', (err) => { | |
console.log({ source: 'uncaughtException', err }); | |
process.exit(1); | |
}); |
OlderNewer