Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯

Deivinson Tejeda deivinsontejeda

🎯
View GitHub Profile
@deivinsontejeda
deivinsontejeda / jwt-expiration.md
Created May 24, 2020 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?
View jwt-expiration.md

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@deivinsontejeda
deivinsontejeda / ladder.md
Created Mar 7, 2018 — forked from jamtur01/ladder.md
Kickstarter Engineering Ladder
@deivinsontejeda
deivinsontejeda / component.js
Created Feb 13, 2018 — forked from adamesque/component.js
Ember Component Life-cycle Docs Feedback
View component.js
import Ember from 'ember';
export default Ember.Component.extend({
/**
Overall thoughts: Ember.Component needs a section in the module doc block outlining the order of events (just like the 1.13 blog post).
Individual events can then refer back to that lifecycle chart to avoid the "runs xth during re-renders but only on thursdays" sentences.
The module doc block should also get the section on what triggers a re-render (from the 1.13 blog post).
*/
myProp: null,
@deivinsontejeda
deivinsontejeda / request.js
Last active Feb 7, 2016
Tiny service which use ember-simple-auth 1.0.0 and wrap any remote call.
View request.js
import Ember from 'ember';
/**
* This service wrap any remote call which needs authorization
* in order to set necessary headers to being authorized
* once the user is logged in
*
*/
const { inject } = Ember;
View docker-command.md

This is a list of Docker command I often use. This does not intend to be a accurate command reference about Docker, it's just a way to not forget some commands

List all Volumens

for x in $(docker ps -qa | sed '1d'); do docker inspect -f '{{ .Volumes }}' ${x}; done

Stop Container by Name

docker ps -a | grep datacollector | awk '{ print $1 }' | xargs docker stop
View gothreads.go
package main
import (
"fmt"
)
const (
GOROTUNIES = 2
)
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View gist:cdd4a27b6a0164a1f1af
require 'irb/completion'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
IRB.conf[:EVAL_HISTORY] = 1000
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = File::expand_path("~/.irbhistory")
#begin
# require 'pry'
# Pry.start
#rescue LoadError
# puts "you need run 'gem install pry'"
View gist:7721060
---
:verbose: false
install: --no-document --env-shebang
:sources:
- https://rubygems.org
:benchmark: false
:backtrace: false
update: --no-document --env-shebang
:update_sources: true
@deivinsontejeda
deivinsontejeda / gist:6919226
Created Oct 10, 2013
Constantize without ActiveSupport
View gist:6919226

Constatize a string without ActiveSupport (commonly come by default in rails) isn't friendly and in some case include AS is overkill. So, with this snipe you can constatize a String.

require 'net/http'
cls = "Net::HTTP".split('::').inject(Object) { |host,name| memo.const_get(name) }

# now you can use cls like normal constant
cls.new