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
| Restore deleted file from git | |
| git log --diff-filter=D --summary | |
| git checkout xxxx~1 filename | |
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
| (function () { | |
| "use strict"; | |
| app.config(function ($provide) { | |
| $provide.decorator('$q', function ($delegate) { | |
| // http://dorp.io/blog/extending-q-promises.html | |
| function decoratePromise(promise) { | |
| promise._then = promise.then; | |
| promise.then = function (thenFn, errFn, notifyFn) { | |
| var p = promise._then(thenFn, errFn, notifyFn); |
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 app = angular.module('MyApp', []); | |
| app.controller('MyController', function($scope, myService) { | |
| myService.getSomething() | |
| .then(function(response) { | |
| $scope.viewModel = response; | |
| }); | |
| }); |
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
| describe('MyController', function () { | |
| var controller, scope, myService, q; | |
| beforeEach(function () { module('MyApp'); }); | |
| beforeEach(inject(function ($controller, $rootScope, $q) { | |
| controller = $controller; | |
| scope = $rootScope.$new(); | |
| myService = jasmine.createSpyObj('myService', ['getSomething']); | |
| q = $q; |
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
| class Array | |
| def skip_first?(accumulator) | |
| return 1 if accumulator.nil? | |
| return 0 unless accumulator.nil? | |
| end | |
| def my_inject(accumulator = nil) | |
| start = skip_first? accumulator | |
| accumulator ||= self.first |
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.Linq; | |
| using NUnit.Framework; | |
| namespace Nest.AutoId | |
| { | |
| [ElasticType(Name = "data", IdProperty = "Id")] | |
| public class DataForGet : DataForIndex | |
| { | |
| public string Id { get; set; } |
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 buttons = $(".js-follow-btn .follow-text :visible"), | |
| interval = setInterval(function(){ | |
| var btn = $(buttons.splice(0, 1)); | |
| console.log("Clicking:", btn); | |
| btn.click(); | |
| if (buttons.length === 0) { | |
| clearInterval(interval); | |
| } | |
| }, 100); |
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
| Get-ChildItem -path '.' -Recurse -Include 'packages.config' | | |
| Select-Xml -xpath '//package/@id' | | |
| Select-Object -ExpandProperty Node | | |
| Select-Object -ExpandProperty value | | |
| Sort-Object -Unique | | |
| ForEach-Object { | |
| foreach($arg in $MyInvocation.UnboundArguments) | |
| { | |
| if($_ -like $arg) | |
| { |
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
| param( | |
| [parameter(Mandatory = $true)] | |
| $packageName | |
| ) | |
| $currentDirectory=$pwd | |
| function CreateTempDir | |
| { | |
| $tmpDir = [System.IO.Path]::GetTempPath() | |
| $tmpDir = [System.IO.Path]::Combine($tmpDir, [System.IO.Path]::GetRandomFileName()) |
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 NinjectIocAdapter : IContainerAdapter | |
| { | |
| private readonly IKernel _kernel; | |
| public NinjectIocAdapter(IKernel kernel) | |
| { | |
| _kernel = kernel; | |
| } | |
| public T TryResolve<T>() |