Skip to content

Instantly share code, notes, and snippets.

@victorstanciu
victorstanciu / gist:2138255
Created March 20, 2012 17:06
Prevent jsftp from sending Keep Alive command after QUIT command has been sent
// self.keepAlive(); <- this is the line I replaced
if (lcCmd == 'quit') {
clearInterval(self._keepAliveInterval);
} else {
self.keepAlive();
}
@victorstanciu
victorstanciu / Auction.php
Created October 9, 2012 05:19
mobilpay request
<?php
class Auction extends Record
{
const STATUS_AUTO_DRAFT = 'auto-draft';
const STATUS_DRAFT = 'draft';
const STATUS_ACTIVE = 'active';
const STATUS_RESERVED = 'reserved';
const STATUS_CANCELED = 'canceled';
public function getExpiryRequest()
{
$request = new Mobilpay_Payment_Request_Sms();
$config = Nip_Config::instance()->MOBILPAY;
$request->url = $config->sandbox ? $config->sandbox_request_url : $config->request_url;
$request->signature = $config->merchant_id;
$request->service = $config->listing_service_id;
$request->returnUrl = Listings::instance()->getMineURL();
public function getURL()
{
if (Nip_Request::instance()->module == 'admin') {
$arguments = func_get_args();
return parent::__call('getURL', $arguments);
}
return $this->getPublicURL();
}
var Modal = function (element, options) {
this.is_open = false;
this.element = $(element);
this.options = options;
if (typeof this.options == 'undefined') {
this.options = {};
}
var modal = this;
@victorstanciu
victorstanciu / common.js
Created October 15, 2012 14:28
Lazy load JS files
function load_script(src, callback) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
script.onload = callback;
script.onreadystatechange = function() {
if (this.readyState == 'loaded' || this.readyState == 'complete') {
, process: function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
, maxScroll = scrollHeight - this.$scrollElement.height()
, offsets = this.offsets
, targets = this.targets
, activeTarget = this.activeTarget
, i
if (scrollTop >= maxScroll) {
document.on('dom:loaded', function () {
var spies = $$('a[data-spy]');
var targets = [];
for (var i = 0; i < spies.length; i++) {
var target = $(spies[i].getAttribute('data-spy'));
target['data-spy'] = spies[i];
targets.push(target);
@victorstanciu
victorstanciu / sample.html
Created November 26, 2012 14:15
Sample document file
<p>This is a test paragraph.</p>
<h3>This is 3rd level heading</h3>
<p>This is a test paragraph.</p>
<h4>This is 4th level heading</h4>
<p>This is a test paragraph.</p>
<h5>This is 5th level heading</h5>
<p>This is a test paragraph.</p>
<h6>This is 6th level heading</h6>
<p>This is a test paragraph.</p>
<h2>Basic block level elements</h2>
#!/bin/bash
svn add `svn status .|grep "^?"|awk '{print $2}'`