This file contains hidden or 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
{ | |
"name": "advanced-react", | |
"version": "1.0.0", | |
"description": "Advanced React", | |
"main": "lib/server.js", | |
"author": "Greg Smith", | |
"license": "MIT", | |
"scripts": { | |
"dev": "nodemon lib/server.js --exec babel-node", | |
"webpack": "webpack -wd", |
This file contains hidden or 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
var possibleCombinationSum = function(arr, n) { | |
if (arr.indexOf(n) >= 0) { return true; } | |
if (arr[0] > n) { return false; } | |
if (arr[arr.length - 1] > n) { | |
arr.pop(); | |
return possibleCombinationSum(arr, n); | |
} | |
var listSize = arr.length, combinationsCount = (1 << listSize) | |
for (var i = 1; i < combinationsCount ; i++ ) { | |
var combinationSum = 0; |
This file contains hidden or 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 Stars = (props) => { | |
return( | |
<div className="col-5"> | |
{_.range(props.numberOfStars).map(i => | |
<i key={i} className="fa fa-star"></i> | |
)} | |
</div> | |
) | |
} |
This file contains hidden or 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 Card = (props) => { | |
return ( | |
<div style={{margin: '1em'}}> | |
<img width="75" src={props.avatar_url} /> | |
<div style={{display: 'inline-block', marginLeft: 10}}> | |
<div style={{fontSize: '1.25em', fontWeight: 'bold'}}> | |
{props.name} | |
</div> | |
<div>{props.company}</div> |
This file contains hidden or 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; | |
using System.Web.Mvc; | |
using Funq; | |
using ServiceStack.ServiceHost; | |
namespace Somewhere | |
{ | |
public class FunqDependencyResolver : IDependencyResolver |
This file contains hidden or 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
var serviceLocator = angular.injector(['ng', 'nameOfAngularApp']); // used to get dependencies like controllers / filters etc | |
var scope = {}; // a clean scope to test | |
var $controllers = serviceLocator.get('$controller'); //get injector that can retrieve controllers | |
var $filters = serviceLocator.get("$filter"); // get filter injector | |
var someService; // define a global used in all tests | |
QUnit.module('the module name', { // define the module - qualify with QUnit namespace to avoid conflict with Angular | |
setup: function () { | |
scope = serviceLocator.get('$rootScope').$new(); // get a clean scope | |
$controllers('theControllerBeingTested', { $scope: scope }) // get the controller to test |
This file contains hidden or 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 sealed class EventLogger | |
{ | |
private static readonly EventLogger Singleton = new EventLogger(); | |
private static readonly EventLogTraceListener EventListener; | |
private static readonly string LogLevel; | |
public static EventLogger Instance | |
{ | |
get { return Singleton; } |
This file contains hidden or 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 SomeController : Controller | |
{ | |
public ActionResult Stuff() | |
{ | |
var user = GetUser(); | |
ViewBag.User = user; | |
return View(); | |
} |