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
### Keybase proof | |
I hereby claim: | |
* I am pnomolos on github. | |
* I am pnomolos (https://keybase.io/pnomolos) on keybase. | |
* I have a public key ASDGvueD_4X-RZ9Dg6XJcBP8MQfIEp8fROLzbxcYcfweRgo | |
To claim this, I am signing this object: |
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
-- See https://wiki.postgresql.org/wiki/Fixing_Sequences for instructions on how to use this | |
SELECT 'SELECT SETVAL(' || | |
quote_literal(quote_ident(PGT.schemaname) || '.' || quote_ident(S.relname)) || | |
', COALESCE(MAX(' ||quote_ident(C.attname)|| ') + 1, 1), false ) FROM ' || | |
quote_ident(PGT.schemaname)|| '.'||quote_ident(T.relname)|| ';' | |
FROM pg_class AS S, | |
pg_depend AS D, | |
pg_class AS T, | |
pg_attribute AS C, |
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 "guard/compat/plugin" | |
module ::Guard | |
class ResqueGuard < Plugin | |
def start | |
puts "Starting Resque" | |
@pid = spawn("bin/resque-pool --hot-swap") | |
Process.detach(@pid) | |
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
module Dry | |
module Types | |
class Struct | |
# A variation on dry-types Struct that includes property writers | |
class Mutable < Struct | |
constructor_type :schema | |
def self.attributes(new_schema) | |
super | |
new_schema.keys.each do |key| |
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
# If you're sending html-only mail (Shame on you! 😆) you can use the following so you get support for | |
# it { should have_sent_email.matching_html_part(/html-only contents/) } | |
module Mail | |
module Matchers | |
class HasSentEmailMatcher | |
def matching_html_part(html_part_matcher) | |
@html_part_matcher = html_part_matcher | |
self | |
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
# A sample Gemfile | |
source "https://rubygems.org" | |
gem 'activerecord' | |
gem 'hotch' | |
gem 'rom-sql' | |
gem 'sqlite3' |
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
Attaching to the process with GDB | |
Populate your .gdbinit and .gdb directories | |
In ~/.gdbinit: | |
define session-ruby | |
source ~/.gdb/ruby | |
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 | |
function chmod_R($path, $filemode = null, $dirmode = null, $skip_hidden = true) { | |
foreach (glob($path, GLOB_MARK) as $path) { | |
if ($skip_hidden && strpos($path, '.') === 0) { | |
continue; | |
} | |
if (is_dir($path)) { | |
if ($dirmode && !chmod($path, $dirmode)) { | |
$dirmode_str=decoct($dirmode); | |
print "Failed applying filemode '$dirmode_str' on directory '$path'\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 | |
namespace Spot; | |
use Spot\Entity; | |
class Type implements Type\TypeInterface | |
{ | |
public static $_loadHandlers = array(); | |
public static $_dumpHandlers = array(); | |
/** |
NewerOlder