npm scripts
are low-level and leverage the actual library you want to use (example:"lint": "eslint ./"
)package.json
is a central place to see what scripts are available (alsonpm run
will list all scripts)- When things get too complicated you can always defer to another file (example:
"complex-script": "babel-node tools/complex-script.js"
) npm scripts
are more powerful than one might first think (pre/post hooks, passing arguments, config variables, chaining, piping, etc...)
<# | |
.SYNOPSIS | |
Detects if the passed Physical Disk Id is a Solid State Disk (SSD) or a | |
spindle disk. Returns true for an SSD and false for anything else. | |
.DESCRIPTION | |
Use Get-PhysicalDisk to get the Physical Disk Ids for the system you wish | |
to test. This script supports values being passed throught the pipeline. | |
The methods used for detecting are by reading the Nominal Media Rotation |
# credit for getting me going in the right direction | |
# http://blogs.lessthandot.com/index.php/uncategorized/access-git-commits-during-a-teamcity-build-using-powershell/ | |
# these properties should be entered into your configuration parameters section | |
$project = "%Octopus.Project%" | |
$deployTo = "%Octopus.DefaultEnvironment%" | |
$buildVersion = "%BuildVersion%" | |
$octopusApiKey = "%Octopus.BuildDeployBot.APIKey%" | |
$octopusServer = "%Octopus.Server.Url%" |
class Hkdf | |
{ | |
Func<byte[],byte[],byte[]> keyedHash; | |
public Hkdf() | |
{ | |
var hmac = new HMACSHA256(); | |
keyedHash = (key, message)=> | |
{ | |
hmac.Key=key; |
to recover files that were added to the index but whose changes were lost (e.g. git reset --hard
)
git fsck --unreachable | grep commit | cut -d\ -f3 | xargs git show
git fsck --unreachable
to get all the items that are unreachablegrep commit
to filter out all entries except for commits (the index will show up as a commit)cut -d\ -f3
to filter out all but the SHA1sxargs git show
to show all of the contents of the objects.
Once you've identified the SHA1 that contains the changes that were lost, check it out to get the working tree back into the state of the index at the time git reset --hard
was run.
NOTE: HTTP SSL keys are all in PEM format (base64 encoded) | |
#From PEM format to DER | |
openssl x509 -in $1.crt -out $1.der -outform DER | |
#From DER format to PEM | |
openssl x509 -in $1.der -inform DER -out $1.pem -outform PEM | |
#Transforming RSA key to DER format | |
openssl rsa -in oberon.key -inform PEM -out oberon_key.der -outform DER |
function hexdump(buffer, blockSize) { | |
blockSize = blockSize || 16; | |
var lines = []; | |
var hex = "0123456789ABCDEF"; | |
for (var b = 0; b < buffer.length; b += blockSize) { | |
var block = buffer.slice(b, Math.min(b + blockSize, buffer.length)); | |
var addr = ("0000" + b.toString(16)).slice(-4); | |
var codes = block.split('').map(function (ch) { | |
var code = ch.charCodeAt(0); | |
return " " + hex[(0xF0 & code) >> 4] + hex[0x0F & code]; |
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
-
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.
Sources : MDN - HTTP Access Control | Wiki - CORS
CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost
. This is primarily set by the header:
Access-Control-Allow-Origin