Skip to content

Instantly share code, notes, and snippets.

var totalLength = $('tbody td form[rel=\'0\']').length;
for(var i = 1; i < totalLength; i++){
console.log('click: ' + i);$('tbody tr:nth-child(' + i +') form[rel=\'0\'] input[type=submit]').click();
pause(300);
}
function pause(milliseconds) {
var dt = new Date();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Newtonsoft.Json;
using StackExchange.Redis;
namespace MSCorp.Ignite.Common
{
public static class ListExtensions
{
public static IEnumerable<IEnumerable<T>> Chunk<T>(this IEnumerable<T> source, int chunkSize)
{
Argument.CheckIfNull(source, "source");
Argument.CheckIfNull(chunkSize, "chunkSize");
if (chunkSize <= 0)
{
throw new ArgumentException("chunkSize should be positive", "chunkSize");
'use strict';
module app.services {
export interface ILoggingService {
logError(errorMessage: string): void;
tryClearErrors(): void;
}
export class LoggingService implements ILoggingService {
constructor(private $injector: any, private connectivityService: app.services.IConectivityService) {
'use strict';
module app.common {
export function stopEvent(): ng.IDirective {
return {
restrict: 'A',
link: (scope: any, element: any) => {
element.bind('click', (event: any) => {
// other ng-click handlers shouldn't be triggered
event.stopPropagation(event);
});
'use strict';
module app.common {
export function spinner(): ng.IDirective {
return {
restrict: 'E',
replace: true,
templateUrl: 'views/templates/spinner.html' // this template can contain an spinner SVG
};
}
@jonocairns
jonocairns / angular-exception-handler
Created April 30, 2015 20:58
Relies on a logging service to be created which points to an API which can log to something like raygun
'use strict';
module app.exception {
angular.module('app.exception')
.config(['$provide', ($provide: ng.auto.IProvideService) => {
$provide.decorator('$exceptionHandler', ['$delegate', 'app.services.LoggingService', '$injector',
($delegate: ng.IExceptionHandlerService, logger: app.services.ILoggingService, $injector: any) => (exception: any) => {
var errorMessage = '';
if (!_.isUndefined(exception) && !_.isNull(exception)) {
'use strict';
module app.common {
export class Guid {
public static newGuid(): string {
return this.generateGuid();
}
'use strict';
module app.services {
export interface IExampleService {
get<T>(): T
}
export class ExampleService implements IExampleService {
constructor(private $http: ng.IHttpService) {
}
@jonocairns
jonocairns / angular-ts-controller
Last active August 29, 2015 14:20
template for an angular controller - written in typescript
'use strict';
module app.common {
export interface IExampleController {
doSomething(value: string): void;
}
class ExampleController {
// properties here
public exampleProp: boolean;