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
lib/jabber/bot.rb | |
204,208d203 | |
< @jabber.roster.add_subscription_request_callback do |item,pres| | |
< @jabber.roster.accept_subscription(pres.from) | |
< puts 'accepted request from ' + pres.from.to_s | |
< 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
<?php | |
$strings = array("racecar", "bob", "b", "abc", "car", "mom", "diary", null, ''); | |
foreach ($strings as $str) { | |
if (palindrome($str)) { | |
print "$str is a palindrome\n"; | |
} else { | |
print "$str is NOT a palindrome\n"; | |
} |
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
<?php | |
echo chr(27) . '[32m' . "This is a green line" . chr(27) . '[0m' . "\n"; | |
echo chr(27) . '[31m' . "This is a red line" . chr(27) . '[0m' . "\n"; | |
function move_right($x) { echo chr(27) . "[{$x}C"; sleep(1); } | |
function move_left($x) { echo chr(27) . "[{$x}D"; sleep(1); } | |
function move_up($x) { echo chr(27) . "[{$x}A"; sleep(1); } |
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
<?php | |
class StringUtil | |
{ | |
public function is_palindrome($str) | |
{ | |
if (!is_string($str)) { | |
return false; | |
} | |
$length = strlen($str); |
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
svn status | grep "^[AM]" | sed "s/^. //" | xargs phpcs |
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
wget --recursive --no-clobber --page-requisites --adjust-extension --convert-links --restrict-file-names=unix --domains guides.rubyonrails.org --no-parent http://guides.rubyonrails.org/v2.3.11/ |
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
ActionMailer::Base.perform_deliveries = true | |
ActionMailer::Base.delivery_method = :smtp | |
ActionMailer::Base.raise_delivery_errors = true | |
ActionMailer::Base.default_charset = "utf-8" | |
ActionMailer::Base.smtp_settings = { | |
:enable_starttls_auto => true, | |
:address => "smtp.gmail.com", | |
:port => "587", | |
:domain => "domain.com", | |
:authentication => :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
curl = Curl::Easy.http_get('https://tinderbox.na15.visual.force.com') | |
curl.header_str | |
http_response, *http_headers = curl.header_str.split(/[\r\n]+/).map(&:strip) | |
http_headers = Hash[http_headers.flat_map{ |s| s.scan(/^(\S+): (.+)/) }] | |
http_response # => "HTTP/1.1 200 OK" | |
http_headers["Location"] |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" | |
ID="alcoelhllgeljalnmneocaeebekgmboefbnaeehk" | |
Version="2.0" | |
IssueInstant="2013-12-14T17:08:02Z" | |
ProtocolBinding="urn:oasis:names.tc:SAML:2.0:bindings:HTTP-Redirect" | |
ProviderName="hostedservice.com" | |
AssertionConsumerServiceURL="https://www.hostedservice.com/sso/saml/acs"/> |
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
<samlp:Response xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" | |
ID="R3fcfe38ecf56858aed1c82e64af35a184365666b" Version="2.0" | |
IssueInstant="2013-12-14T17:39:06Z" Destination="https://www.hostedservice.com/sso/saml/acs" | |
InResponseTo="_8dc163f0-4714-0131-0e2a-20c9d04963c9"> | |
<saml:Issuer>https://app.onelogin.com/saml/metadata/XXXXXX</saml:Issuer> | |
<samlp:Status> | |
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" /> | |
</samlp:Status> | |
<saml:Assertion xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
OlderNewer