Skip to content

Instantly share code, notes, and snippets.

View matija's full-sized avatar

Matija Munjaković matija

View GitHub Profile
@matija
matija / keybase.md
Last active September 15, 2021 19:44

Keybase proof

I hereby claim:

  • I am matija on github.
  • I am matija (https://keybase.io/matija) on keybase.
  • I have a public key whose fingerprint is A323 3325 A3F6 0F9E 5B67 0761 39F4 DB5D 46D3 1D03

To claim this, I am signing this object:

defaults write com.microsoft.VSCode CGFontRenderingFontSmoothingDisabled 0
defaults write com.microsoft.VSCode.helper CGFontRenderingFontSmoothingDisabled 0
defaults write com.microsoft.VSCode.helper.EH CGFontRenderingFontSmoothingDisabled 0
defaults write com.microsoft.VSCode.helper.NP CGFontRenderingFontSmoothingDisabled 0
@matija
matija / decode.rb
Last active November 5, 2018 09:17
def self.decode(token)
 payload = JWT.decode token, self.hmac_secret, true, { :algorithm => 'HS256' }
end
def decoded_auth_token
 @decoded_auth_token ||= AuthToken.decode(http_auth_token)[0]
end
public void readUserToken(View view) {
 IntentIntegrator integrator = new IntentIntegrator();
 integrator.initiateScan();
}
before_filter :authenticate_request!, :except => :handshake
def authenticate_request!
 fail StandardError.new('NotAuthenticatedError') unless user_id_included_in_auth_token?
 @current_user = User.find(decoded_auth_token['user_id'])
 rescue JWT::ExpiredSignature
 raise StandardError.new('AuthenticationTimeoutError')
 rescue JWT::VerificationError, JWT::DecodeError
 raise StandardError.new('NotAuthenticatedError')
end
SharedPreferences prefs = getSharedPreferences("USER_PREFS", Context.MODE_PRIVATE);
String userToken = prefs.getString("userIdKey", null);
@matija
matija / reset-icon-cache.txt
Created April 9, 2018 19:03
reset-icon-cache.txt
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3; killall Dock; killall Finder
@matija
matija / jwt_auth_controller.rb
Last active April 11, 2018 14:39
jwt_auth_controller.rb
class JWTAuthController < ActionController::API
attr_reader :current_user
protected
def authenticate_request!
fail StandardError.new('NotAuthenticatedError') unless user_id_included_in_auth_token?
@current_user = User.find(decoded_auth_token['user_id'])
rescue JWT::ExpiredSignature
raise StandardError.new('AuthenticationTimeoutError')