Skip to content

Instantly share code, notes, and snippets.

Spin0us spin0us

Block or report user

Report or block spin0us

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
naholyr / sftp.php
Created May 23, 2012
SFTP using SSH2 extension
View sftp.php
// Connect to sftp server
function sftp_connect(array $config)
if (!function_exists('ssh2_connect')) {
throw new Exception('Extension SSH2 not installed: check server configuration');
$options = array_merge(array(
naholyr / function-argnames.js
Created Feb 19, 2012
JS Introspection: extract function parameter names
View function-argnames.js
Function.prototype.argNames = function () {
// Extract function string representation: hopefully we can count on it ?
var s = this.toString();
// The cool thing is: this can only be a syntactically valid function declaration
s = s // "function name (a, b, c) { body }"
.substring( // "a, b, c"
s.indexOf('(')+1, // ----------------^
s.indexOf(')') // ------^
You can’t perform that action at this time.