Skip to content

Instantly share code, notes, and snippets.

View deivinsontejeda's full-sized avatar
🎯

Deivinson Tejeda deivinsontejeda

🎯
  • Santiago of Chile
View GitHub Profile
@deivinsontejeda
deivinsontejeda / ssl_puma.sh
Created December 21, 2023 20:17 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@deivinsontejeda
deivinsontejeda / jwt-expiration.md
Created May 24, 2020 17:57 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

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 March 7, 2018 01:48 — forked from jamtur01/ladder.md
Kickstarter Engineering Ladder
@deivinsontejeda
deivinsontejeda / component.js
Created February 13, 2018 20:22 — forked from adamesque/component.js
Ember Component Life-cycle Docs Feedback
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,
class SimpleLinearRegression
def initialize(xs, ys)
@xs, @ys = xs, ys
if @xs.length != @ys.length
raise "Unbalanced data. xs need to be same length as ys"
end
end
def y_intercept
mean(@ys) - (slope * mean(@xs))
require 'json'
class JsonFormatter
METHODS = %w[start close stop start_dump dump_pending dump_failures dump_summary]
METHODS.each { |m| define_method(m) { |*a| } }
def initialize(out)
@output = out
@event_id = 0
@passed = true
# delay the GC - usage as below
# Spec::Runner.configure do |config|
.....
# config.before(:each) do
# begin_gc_deferment
# end
# config.after(:each) do
@deivinsontejeda
deivinsontejeda / rspec-syntax-cheat-sheet.rb
Created September 3, 2012 01:09 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
#!/usr/bin/env ruby
param = ARGV.first
class Fixnum
def is_cachipulis?
length = self.to_s.length
digits = self.to_s.split('').map(&:to_i)
return false if digits.inject(&:+) != length