Skip to content

Instantly share code, notes, and snippets.

@jfollmann
jfollmann / spread-destructuring-rest-operator.js
Last active May 17, 2023 12:01
Spread, Destructuring and Rest Operator (Javascript)
// Execute: node spread-destructuring-rest-operator.js
// #### Spread Operator ####
const e1 = 'CODE';
const r1 = [...e1];
console.log('[01]', r1)
// Output => [ 'C', 'O', 'D', 'E' ]
const e2 = ['This', 'is', 'a', 'sentence'];
console.log('[02]', ...e2);
@Vinai
Vinai / MockTraitMethodTest.php
Created November 12, 2014 16:48
How to mock a trait method using getMockForTrait()
class MockTraitMethodTest extends \PHPUnit_Framework_TestCase
{
public function testTraitMock()
{
// Inspect getMockForTrait signature for what the other arguments do.
$methodsToMock = ['getBar'];
$mockTrait = $this->getMockForTrait('\Example\Foo', [], '', true, true, true, $methodsToMock);
$mockTrait->expects($this->any())
->method('getBar')
->willReturn('buz');
@dclucas
dclucas / win-dev-setup.ps1
Last active August 29, 2015 14:02
Dev setup
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
cinst binroot
cinst git.install
cinst 7zip.install
cinst GoogleChrome
cinst fiddler4
cinst git-credential-winstore
cinst sublimetext3