Skip to content

Instantly share code, notes, and snippets.

View tquiroga's full-sized avatar

Thomas Quiroga tquiroga

View GitHub Profile
@tquiroga
tquiroga / cloudSettings
Last active May 20, 2020 08:35
Rooser Team VSCode config
{"lastUpload":"2020-05-20T08:35:31.239Z","extensionVersion":"v3.4.3"}
@tquiroga
tquiroga / i18n-sync.js
Last active June 7, 2019 15:56
i18next-scanner Sync
/**
*
* Sync translations between what i18next-scanner gets and what already exists
* - i18next-scanner scans everything and all all in i18n/{{lang}}/missing/{{ns}}.json
* - Missing translations values are always null
* - Existing translations are kept in i18n/{{lang}}/{{ns}}.json
* - If a string gets removed in missing/{{ns}}.json it will get removed in existing one
*
* HOW TO USE THIS SCRIPT
*
@tquiroga
tquiroga / flightplan-deploy.md
Last active May 17, 2016 10:58 — forked from learncodeacademy/flightplan-deploy.md
Deploy Node.js Apps with Flightplan

##Setup your server (this would ideally be done with automated provisioning)

  • add a deploy user with password-less ssh see this gist
  • install forever npm install -g forever

##Install flightplan

  • npm install -g flightplan
  • in your project folder npm install flightplan --save-dev
  • create a flightplan.js file
@tquiroga
tquiroga / note_policy.rb
Last active August 29, 2015 14:20
Pundit authorization for custom action?
class NotePolicy < ApplicationPolicy
# For index action
class Scope
attr_reader :user, :scope
def initialize(user, scope)
@user = user
@scope = scope
end
@tquiroga
tquiroga / ability.rb
Created January 14, 2015 17:46
Cancan Auth
can :index, Message, :project_id => project.id # AND user.projects.include?(project)
#I tried adding after it, doesn't work, it's ignored
can :index, Message if user.projects.include?(project)
@tquiroga
tquiroga / gist:4665c4bb86d3a4d4ee49
Created October 28, 2014 09:46
Restrict JSON output
def as_json(options={})
logger.fatal "---- AS JSON -----"
options[:except] ||= [
:authentication_token,
:invitation_token,
]
super(options)
end
@tquiroga
tquiroga / gist:e8b936c039aecb771be7
Created August 10, 2014 01:05
Capistrano Output :(
Uploading /tmp/myproject/git-ssh.sh 100.0%
[bb0cc372] Running /usr/bin/env chmod +x /tmp/myproject/git-ssh.sh on 104.131.193.30
[bb0cc372] Command: /usr/bin/env chmod +x /tmp/myproject/git-ssh.sh
[bb0cc372] Finished in 0.312 seconds with exit status 0 (successful).
[9bf42d25] Running /usr/bin/env git ls-remote [email protected]:1664/tquiroga/myproject.git on 104.131.193.30
[9bf42d25] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/myproject/git-ssh.sh /usr/bin/env git ls-remote [email protected]/tquiroga/myproject.git )
[9bf42d25] Enter passphrase for key '/home/deploy/.ssh/id_rsa':