Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Fabricio Quagliariello fmquaglia

🎯
Focusing
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
View 01_requirements.md

REQUIREMENTS

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
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'})";
document.head.appendChild(elt);
(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]
</IfModule>
# END WordPress
View UI.js
'use strict';
angular.module('circleBackApp').controller(
'UICtrl',
function($scope,
$analytics,
$filter,
$location,
$log,
$q,
View Contacts.js
'use strict';
angular.module('circleBackApp')
.controller('ContactsCtrl',
function($scope,
$routeParams,
$route,
$rootScope,
$location,
$timeout,
View Contacts.js
'use strict';
angular.module('circleBackApp')
.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
fmquaglia / README.md
Last active Dec 11, 2015
question to Ravi
View README.md

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 my.foo

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
fmquaglia / main.rb
Created Oct 6, 2015
promising-future example with ost
View main.rb
# See https://github.com/bhuga/promising-future
require "ost"
require "future"
Ost.redis.call('FLUSHDB')
300.times do |i|
Ost[:foo] << i
end
View credentials_controller.rb
class CredentialsController < ApplicationController
def authorize_credentials
redirect_to new_polymorphic_path([current_user, credential_type.new], request.query_parameters)
end
private
def credential_type
Credentials::SalesforceInstanceCredential
You can’t perform that action at this time.