Skip to content

Instantly share code, notes, and snippets.

View bascht's full-sized avatar
📢
Setting all the statuses.

Sebastian Schulze bascht

📢
Setting all the statuses.
View GitHub Profile
@bascht
bascht / throw.rb
Last active August 29, 2015 14:20
begin
puts "All is well"
class DiesenErrorGibtEsHierNicht < Exception; end
throw DiesenErrorGibtEsHierNicht
rescue DiesenErrorGibtEsHierNicht => e
puts "Well."
end
glasses = Exception
def your(what); what end
begin
raise your glasses
rescue glasses => e
puts "You could have recycled this #{e}!"
end
struct Record {
company: String,
address: String,
email: String,
}
impl ToString for Record {
fn to_string(&self) -> String {
let mut slice = self.company.clone().truncate(3);
return slice;
generic::variable: 'value'
some_class::myvar: '%{generic::variable}'
other_class::myvar: '%{generic::variable}'
$ pip install --user passpie
Downloading/unpacking passpie
Could not find a version that satisfies the requirement passpie (from versions: 0.1rc1, 0.1rc2, 0.1rc3, 0.1rc4, 0.1rc5, 0.1rc6)
Cleaning up...
No distributions matching the version for passpie
Storing complete log in /home/bascht/.pip/pip.log
@bascht
bascht / geht.rb
Last active August 29, 2015 14:20
[3] pry(main)> def foo(bar, baz=bar); baz; end
=> :foo
[4] pry(main)> foo("oha")
=> "oha"
<!doctype html>
<!--
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@bascht
bascht / scopes.pp
Created May 8, 2015 10:13
Scopes & co
class a {
$foo = "value"
}
class b {
include a
$foo = "So. Und nun?"
}
#0 zval_scan_black (pz=0x1f0c93800) at /usr/src/debug/php-5.6.8/Zend/zend_gc.c:294
#1 0x00000000005d9f9c in zval_scan_black (pz=<value optimized out>) at /usr/src/debug/php-5.6.8/Zend/zend_gc.c:326
#2 0x00000000005d9fee in zval_scan_black (pz=<value optimized out>) at /usr/src/debug/php-5.6.8/Zend/zend_gc.c:301
#3 0x00000000005d9f9c in zval_scan_black (pz=<value optimized out>) at /usr/src/debug/php-5.6.8/Zend/zend_gc.c:326
#4 0x00000000005d9fee in zval_scan_black (pz=<value optimized out>) at /usr/src/debug/php-5.6.8/Zend/zend_gc.c:301
#5 0x00000000005d9fee in zval_scan_black (pz=<value optimized out>) at /usr/src/debug/php-5.6.8/Zend/zend_gc.c:301
#6 0x00000000005d9f9c in zval_scan_black (pz=<value optimized out>) at /usr/src/debug/php-5.6.8/Zend/zend_gc.c:326
#7 0x00000000005d9f9c in zval_scan_black (pz=<value optimized out>) at /usr/src/debug/php-5.6.8/Zend/zend_gc.c:326
#8 0x00000000005d9f9c in zval_scan_black (pz=<value optimized out>) at /usr/src/debug/php-5.6.8/Zend/zend_gc.c:326
#9 0x000000
#!/usr/bin/env ruby
require 'openssl'
require 'net/http'
http = Net::HTTP.new('www.example.org', 443)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
two_weeks_from_now = Time.now + (2*7*24*60*60)