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
class Player | |
Directions = [:left, :right, :forward, :backward] | |
FullHealth = 20 | |
def full_health? | |
@warrior.health == FullHealth | |
end | |
def whats_out_there? |
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
def gravatar_url(email,options = {}) | |
require 'digest/md5' | |
hash = Digest::MD5.hexdigest(email) | |
url = "http://www.gravatar.com/avatar/#{hash}" | |
options.each do |option| | |
option == options.first ? url+="?" : url+="&" | |
key = option[0].to_s | |
value = option[1].to_s | |
url+=key + "=" + value | |
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
[/\[gist\](.*?)\[\/gist\]/,'<script src="http://gist.github.com/\1.js"> </script>',:code_enabled], | |
[/\[gist=(.*?)\](.*?)\[\/gist\]/,'<script src="http://gist.github.com/\2.js?file=\1"> </script>',:code_enabled] |
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
def create | |
@post = Post.find(params[:post_id]) if params[:post_id] | |
@post = Post.find(params[:comment][:post_id]) if params[:comment][:post_id] | |
@comment = @post.comments.new(params[:comment]) | |
@comment.user_id = current_user.id if current_user | |
if @comment.body.spam? then | |
unless params[:recaptcha_challenge_field] then | |
flash[:error] = "Comment looks like Spam" | |
render :action => 'new' | |
else |
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
def up_handler(input) | |
input.upcase | |
end | |
>> "[up]HeLlo WorLd[/up]".tbbc(:custom_tags => [[/\[up\](.*?)\[\/up\]/,"Callback: up_handler",true]]) | |
=> "HELLO WORLD" |
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
HKEY_CURRENT_USER = &H80000001 | |
strComputer = "." | |
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") | |
strKeyPath = "Software\Microsoft\Internet Explorer\Desktop\SafeMode\Components" | |
strValue = "0" | |
ValueName = "DeskHtmlVersion" | |
objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, ValueName, strValue |
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
def create | |
user = User.find_by_provider_and_uid("ldap",params[:username]) || User.create_with_omniauth("ldap",params[:username]) | |
session[:user_id] = user.id | |
redirect_to "/pages/splash" | |
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
def create | |
ldap_user = ActiveDirectoryUser.authenticate(params[:username], params[:password]) | |
user = User.find_by_provider_and_uid("ldap",params[:username]) || User.create_with_omniauth("ldap",params[:username]) | |
user.name = ldap_user.name | |
user.groups = ldap_user.groups.join(",") | |
user.save | |
if LDAP_AllowedGroups != (LDAP_AllowedGroups - user.groups.split(",")) then | |
session[:user_id] = user.id | |
redirect_to "/pages/splash" | |
else |
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
SERVER = '10.0.0.1' # Active Directory server name or IP | |
PORT = 389 # Active Directory server port (default 389) | |
BASE = 'DC=arcath,DC=local' # Base to search from | |
DOMAIN = 'arcath.local' # For simplified user@domain format login |
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
' Printer Script based on AD OU | |
' Written by Adam Laycock (Arcath) | |
' July 2009 | |
' Updated December 2011 | |
' Variables | |
Set WshNetwork = WScript.CreateObject("WScript.Network") ' Network Object | |
Set oPrinters = WshNetwork.EnumPrinterConnections ' Printers Sub Object | |
printServer = "printserver" ' Hostname of your Print Server (add more if you have multiple print servers |
OlderNewer