Skip to content

Instantly share code, notes, and snippets.

Avatar

Constantine Kim 김현진 elegantcoder

View GitHub Profile
@ergo70
ergo70 / cognito_PAM.py
Last active Sep 1, 2021
pam-python PAM module for AWS Cognito
View cognito_PAM.py
import boto3
import jwt
from json import dumps
from requests import get
from botocore import UNSIGNED
from botocore.config import Config
from warrant.aws_srp import AWSSRP
from cryptography.hazmat.primitives import serialization
_PAM_DUMMY_PROMPT = ''
@hyeonseok
hyeonseok / diff2html.php
Last active Dec 22, 2015
Word diff to HTML
View diff2html.php
<?php
/*
http://hyeonseok.com/soojung/dev/2013/09/02/743.html
git diff -U1 --word-diff > ../diff.txt
Execute this command from repository then run this script.
*/
$diff_file = file('diff.txt');
@kyletcarlson
kyletcarlson / rspec_model_testing_template.rb
Last active Sep 15, 2021
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@henrik
henrik / example.rb
Created Jan 26, 2012
Simple memoize method for Ruby now that ActiveSupport::Memoizable is deprecated. Memoizes per argument set, handles falsy values.
View example.rb
def my_method(foo, bar)
memoize(:my_method, foo, bar) do
foo * bar
end
end
@sinisterchipmunk
sinisterchipmunk / LICENSE
Last active Jun 22, 2021
tar, gzip, and untar files using ruby in memory without tempfiles
View LICENSE
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in