As easy as 1, 2, 3!
Updated:
- Aug, 08, 2022 update
config
docs for npm 8+ - Jul 27, 2021 add private scopes
- Jul 22, 2021 add dist tags
- Jun 20, 2021 update for
--access=public
- Sep 07, 2020 update docs for
npm version
public HttpContextBase FakeHttpContext() { | |
var context = new Mock<HttpContextBase>(); | |
var files = new Mock<HttpFileCollectionBase>(); | |
var request = new Mock<HttpRequestBase>(); | |
var response = new Mock<HttpResponseBase>(); | |
var session = new Mock<HttpSessionStateBase>(); | |
var server = new Mock<HttpServerUtilityBase>(); | |
var user = new Mock<IPrincipal>(); | |
var identity = new Mock<IIdentity>(); | |
request.Setup(req => req.ApplicationPath).Returns("~/"); |
using System; | |
using System.Collections.Generic; | |
using System.Collections.Specialized; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
using Moq; | |
/// <summary> | |
/// This helper class can be used to set up Moq mocks of MVC3/4 controllers. |
object randomSample { | |
def randomString(length: Int) = Stream.continually(util.Random.nextPrintableChar) take length mkString | |
} | |
println(randomSample.randomString(64)) |
import android.content.Context; | |
import android.graphics.drawable.Drawable; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; | |
import android.view.View; | |
import android.widget.AutoCompleteTextView; | |
/** | |
* sub class of {@link android.widget.AutoCompleteTextView} that includes a clear (dismiss / close) button with | |
* a OnClearListener to handle the event of clicking the button |
# Ruby is our language as asciidoctor is a ruby gem. | |
lang: ruby | |
before_install: | |
- sudo apt-get install pandoc | |
- gem install asciidoctor | |
script: | |
- make | |
after_success: | |
- .travis/push.sh | |
env: |
object hackerrank { | |
object Solution { | |
def main(args: Array[String]) { | |
def fact(n: Int): Int = if (n == 1) 1 else n * fact(n - 1) | |
for (n <- io.Source.stdin.getLines) { | |
print(fact(Integer.parseInt(n.toString)) + "\n") | |
} | |
} | |
} |
var revealJS = function(s) { | |
var hexAlphabet = Array.apply(null, { | |
length: 10 | |
}).map(Number.call, Number).concat('abcdef'.split('')); | |
var codes = [8289, 8204, 8205, 8206, 8207, 8234, 8235, 8236, 8237, 8238, 8298, 8299, 8300, 8301, 8302, 8303]; | |
return s.match(/(.{4})/g).map(function(b) { | |
return b.split('').map(function(i) { | |
return hexAlphabet[codes.indexOf(i.charCodeAt())] | |
}) |
Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent