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
require 'net/ldap' | |
ldap = Net::LDAP.new | |
ldap.host = "192.168.222.154" | |
ldap.port = 389 | |
ldap.auth "cn=netreader,dc=wildix", "wildix" | |
if !ldap.bind | |
puts "Connection failed" | |
end |
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
COMMANDS = { | |
'collect' => ['info', 'info2'], | |
'watch' => ['watchvalue_1', 'watchvalue_2'] | |
} | |
comp = proc do |s| | |
if Readline.line_buffer =~ /#{COMMANDS.keys} / | |
COMMANDS.values_at("#{Readline.line_buffer.gsub(/ .*/,'')}").flatten.grep(/^#{Regexp.escape(s)}/) | |
else | |
COMMANDS.keys.grep(/^#{Regexp.escape(s)}/) |
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
#!/usr/bin/env ruby | |
# require all the necessary files | |
$: << ::File.expand_path('../src', __FILE__) | |
require 'app' | |
require 'geofence' | |
# at this point bundler should be setup and the :development group | |
# should have been included. However, just to be sure, I'm going to | |
# include bundler again and require the console group. |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- | |
A simple example of PIN-based oauth flow with Twitter and jsOAuth. | |
This is mostly based on/copied from <http://log.coffeesounds.com/oauth-and-pin-based-authorization-in-javascri>. | |
Get jsOAuth at <https://github.com/bytespider/jsOAuth/downloads> |
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
*.pbxproj -crlf -diff -merge |
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
helpers do | |
def measure (&block) | |
start_time = Time.now | |
val = yield | |
end_time = Time.now | |
logger.info "Time elapsed for #{request.path_info} #{(end_time - start_time)*1000} milliseconds" | |
val | |
end | |
end |
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
"use strict"; | |
var app = angular.module('charts',['charts.services', 'charts.directives']); | |
app.config(['$routeProvider', function($routeProvider) { | |
$routeProvider. | |
when('/', { | |
controller: 'MenuCtrl', | |
templateUrl:'/users.html' | |
}). |
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 Person = function(name, surname, gender){ | |
this.name = function(){ | |
console.log('instance function ' + name); | |
}; | |
this.surname = surname; | |
this.gender = gender; | |
}; | |
Person.prototype.getGender = function(){ |
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 https = require('https'); | |
var gunzip = require('zlib').createGunzip(); | |
var options = { | |
host: 'api.stackexchange.com', | |
path: '/2.1/info?site=stackoverflow' | |
}; | |
https.get(options, function(res) { | |
var body = ''; |
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
Network = function(input, hidden, output) { | |
if (arguments.length !== 3) { | |
console.log('Check your arguments, quitting...'); | |
process.exit(); | |
} | |
this.B1 = 1.0; | |
this.B2 = 1.0; | |
for (var i = 1; i <= input; i++) { | |
this['I' + i] = 0; |
OlderNewer