Skip to content

Instantly share code, notes, and snippets.


Fabricio Quagliariello fmquaglia

Block or report user

Report or block fmquaglia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile


You need to design a programming module PERMISSIONS that would allow Caller to Grant a permission to a User.
Check if a User has a particular Permission.

Caller is an external system that uses our module (particularly it calls our API).

Permission is a user right to take an action or access a resource.
Permissions for resource access can be READ or WRITE.
For example, Caller can grant a permission ”reboot the server” (an example of action) OR write to a file “C:/readme.txt” (an example of resource) to a user Andrew.

fmquaglia / example.js
Created Jun 29, 2017
CleverTap integration with a Chrome extension
View example.js
console.log("Extension is active");
var elt = document.createElement("script");
elt.innerHTML = "window.clevertap = {event:[], profile:[], account:[], notifications:[], onUserLogin:[]};window.clevertap.account.push({'id': '846-Z7Z-6K4Z'})";
(function () {
var wzrk = document.createElement('script');
wzrk.type = 'text/javascript';
wzrk.async = true;
View .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
View UI.js
'use strict';
View Contacts.js
'use strict';
View Contacts.js
'use strict';
.service('Contacts', function($rootScope, $http, $localStorage, $log, $q, $filter, $timeout, CBCore, AuthService, Sorting, Groups) {
var Contacts = {};
Contacts.byId = {}; // contactId: Contact
Contacts.byGroupId = {}; // groupId: {contactId: Contact} LIVE contacts only
Contacts.groupsByContactId = {}; // contactId: {id: group}
Contacts.trashById = {}; // contactId: Contact
fmquaglia /
Last active Dec 11, 2015
question to Ravi

Passing parameters to an email script token

Is there a way to "pass a parameter" to an email script token?

We would like to pass a string to an email script from the email definition, in the same way the user defines a default value for the token, and thus be able to use that string in the velocity script.

Let's say we have an email script token called

This hypotetical token is meant to be used in the email by passing a "parameter" (let's suppose we call this parameter bar)

View killLongRunningOps.js
// kills long running ops in MongoDB (taking seconds as an arg to define "long")
// attempts to be a bit safer than killing all by excluding replication related operations
// and only targeting queries as opposed to commands etc.
killLongRunningOps = function(maxSecsRunning) {
currOp = db.currentOp();
for (oper in currOp.inprog) {
op = currOp.inprog[oper-0];
if (op.secs_running > maxSecsRunning && op.op == "query" && !op.ns.startsWith("local")) {
print("Killing opId: " + op.opid
fmquaglia / main.rb
Created Oct 6, 2015
promising-future example with ost
View main.rb
# See
require "ost"
require "future"'FLUSHDB')
300.times do |i|
Ost[:foo] << i
View credentials_controller.rb
class CredentialsController < ApplicationController
def authorize_credentials
redirect_to new_polymorphic_path([current_user,], request.query_parameters)
def credential_type
You can’t perform that action at this time.