View NightmareJSInfiniteScroll.js
var previousHeight, currentHeight=0;
while(previousHeight !== currentHeight) {
previousHeight = currentHeight;
var currentHeight = yield nightmare.evaluate(function() {
return document.body.scrollHeight;
});
yield nightmare.scrollTo(currentHeight, 0)
.wait(3000);
}
View AddressPOCO.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Validation
{
public class AddressComponent {
public string long_name { get; set; }
public string short_name { get; set; }
public List<string> types { get; set; }
View Extensions.cs
public static class Extensions{
/**
* Rounds the supplied number to the nearest multiple of the parameter
* @param this int The number to round
* @param int The multiple to use
* @return int
* @static
* @extension
*/
View TerrainMath.cs
public static class TerrainMath{
/**
* Gets the XBase and width based on bounds input
* @param portalBounds The bounds of the Box collider to use
* @param terrainBounds The bounds of the terrain collider to use
* @return Vector2 Where X is the XBase and Y is the Width
* @static
*/
public static Vector2 GetXBaseAndWidth(Bounds portalBounds, Bounds terrainBounds){
View mysqlBackup.sh
#!/bin/bash
mysqldump -u root -p[PASSWORD] --all-databases | gzip > /PATH/TO/STORE/BACKUP/mysqldb_`date +%F`.sql.gz
View Readme.txt
Name: restrictInput
Signature: restrictInput(string type, event keypress);
Description: Restricts input to fields to specified values
Usage: $("#myfieldID").keydown(function(e)){
restrictInput("alpha",e);
};
Types:
alphanumeric - All letters and numbers
View ForceNumeric.js
$("selector").keydown(function (e) {
// backspace, delete, tab, escape, enter and .
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
// Ctrl+A, Command+A
(e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) ||
// home, end, left, right, down, up
(e.keyCode >= 35 && e.keyCode <= 40)) {
return;
}
View slackreport.js
// Thanks to Michael Rush for the original version of this rule (https://software-development.dfstudio.com/youtracks-new-javascript-workflows-make-slack-integration-a-breeze-d3275605d565)
// IMPORTANT: Use a valid Incoming Webhook from Slack. To get one, go to https://my.slack.com/services/new/incoming-webhook/
var SLACK_WEBHOOK_URL = 'WEBHOOKURL';
var entities = require('@jetbrains/youtrack-scripting-api/entities');
var http = require('@jetbrains/youtrack-scripting-api/http');
var workflow = require('@jetbrains/youtrack-scripting-api/workflow');
exports.rule = entities.Issue.onChange({
View Imager.cs
public class Imager : IDisposable{
private string _persist = "NO";
private Process _networkMap;
public void Dispose()
{
_networkMap.Close();
}
View IsPrime.cs
public static bool CalcIsPrime(dynamic number,out dynamic failure)
{
failure = 0;
if (number == 1) return false;
if (number == 2) return true;
if (number % 2 == 0) return false;
for (dynamic i = 2; i < (number/2); i++)
{