This file contains 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
from twisted.words.protocols import irc | |
from twisted.internet import reactor, protocol | |
import sys, os, subprocess, tempfile | |
class CycriptBot(irc.IRCClient): | |
nickname = "cycriptbot" | |
def __init__(self): | |
self.process = "SpringBoard" |
This file contains 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
/** | |
* version1: convert online image | |
* @param {String} url | |
* @param {Function} callback | |
* @param {String} [outputFormat='image/png'] | |
* @author HaNdTriX | |
* @example | |
convertImgToBase64('http://goo.gl/AOxHAL', function(base64Img){ | |
console.log('IMAGE:',base64Img); | |
}) |
This file contains 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 Nightmare = require('nightmare'); | |
var nightmare = Nightmare({ show: true }); | |
nightmare | |
.goto('http://example.com/') | |
.click('.buttonOpenModal') | |
.wait('div.Buttons') | |
.evaluate(function () { | |
var interval = setInterval(function () { | |
var btn = document.querySelectorAll('div.Buttons'); |
This file contains 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 Nightmare = require('nightmare'); | |
var vo = require('vo'); | |
vo(run)(function(err, result) { | |
if (err) throw err; | |
}); | |
function* run() { | |
var nightmare = Nightmare({ show: true }), | |
MAX_PAGE = 100, |
This file contains 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 Nightmare = require('nightmare'); | |
var vo = require('vo'); | |
var nightmare = Nightmare({ | |
show: true | |
}); | |
var run = function * () { | |
yield nightmare.goto('http://scrollmagic.io/examples/advanced/infinite_scrolling.html'); | |
var previousHeight, currentHeight=0; |
This file contains 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 machina = require('machina'); | |
var vehicleSignal = new machina.BehavioralFsm( { | |
initialize: function( options ) { | |
// your setup code goes here... | |
}, | |
namespace: "vehicle-signal", |
This file contains 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
// https://github.com/nsubstitute/NSubstitute/issues/210#issuecomment-158282595 | |
foo.WhenStuffHappened.Returns(Observable.Return(5)); | |
// or | |
foo.WhenStuffHappened.Returns(Observable.Empty()); | |
// or | |
foo.WhenStuffHappened.Returns(Observable.Throws(new Exception("Die"))); |
This file contains 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
/** | |
* Wait for a specified number of milliseconds. If a promise hasn't resolved, reject it. | |
* This is a necessary replacement in some cases since cancellable promises aren't a thing | |
* and is helpful if you want to wait _no longer than_ a specified amount of time. | |
* @param {int} time Amount of time to wait before resolving arbitrarily. | |
* @param {function} fn That returns a Promise. It will be run one tick before the timer starts. | |
* @return {Promise} | |
*/ | |
export function waitAndCatch(time, fn) { | |
return new Promise((resolve, reject) => { |
This file contains 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
// Creates a new promise that automatically resolves after some timeout: | |
Promise.delay = function (time) { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, time) | |
}) | |
} | |
// Throttle this promise to resolve no faster than the specified time: | |
Promise.prototype.takeAtLeast = function (time) { | |
return new Promise((resolve, reject) => { |
This file contains 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
[AppSettings("smtp:")] | |
public interface SmtpConfiguration | |
{ | |
string Name { get; set; } | |
int Port { get; set; } | |
string Username { get; set; } | |
} |
OlderNewer