Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Vladimir Vukanac vukanac

🎯
Focusing
Block or report user

Report or block vukanac

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
@vukanac
vukanac / authorize.ex
Created Apr 16, 2020 — forked from jeremytregunna/authorize.ex
After refactoring...
View authorize.ex
defmodule Api.Authorize do
alias Account.Models.User
alias Tracker.OrganizationMembers, as: OM
def board?(board_id, %User{} = user, available_perms, required_perms) do
with(
{:ok, board} <- Tracker.Board.find(board_id),
true <- OM.user_in_organization?(user.id, board.organization_id)
) do
required_perms == common_permissions(required_perms, available_perms)
@vukanac
vukanac / watcher.sh
Created Apr 16, 2020 — forked from josevalim/watcher.sh
A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance
View watcher.sh
# You will need fswatch installed (available in homebrew and friends)
# The command below will run tests and wait until fswatch writes something.
# The --stale flag will only run stale entries, it requires Elixir v1.3.
fswatch lib/ test/ | mix test --stale --listen-on-stdin
@vukanac
vukanac / mfa-login.py
Created Mar 28, 2020 — forked from pfumagalli/mfa-login.py
AWS Command Line MFA Login
View mfa-login.py
#!/usr/bin/env python3
import dateutil.parser, dateutil.tz, datetime, json, os, sys, boto3, stat
from subprocess import Popen, PIPE
# Get the profile, first argument on the command line
if (len(sys.argv) < 2):
raise Exception('Profile name not specified on command line')
profile = sys.argv[1]
@vukanac
vukanac / osx_bootstrap.sh
Created Mar 26, 2019 — forked from codeinthehole/osx_bootstrap.sh
Script to install stuff I want on a new OSX machine
View osx_bootstrap.sh
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
View gist:190a339305313699cad9d3985cbbcf18
it('should refuse partial submissions', function(done) {
var browser = this.browser;
browser.fill('first_name', 'John');
browser.pressButton('Send').then(function() {
assert.ok(browser.success);
assert.equal(browser.text('h1'), 'Contact');
assert.equal(browser.text('div.alert'), 'Please fill in all the fields');
}).then(done, done);
});
View Improve cURL & API Calls.md
    use phpFastCache\CacheManager;

    $cache = CacheManager::Memcached();

    // try to get from Cache first.
    $resultsItem = $cache->getItem("identity_keyword")

    if(!$resultsItem->isHit()) {
        $resultsItem->set($cURL->get("http://www.youtube.com/api/json/url/keyword/page"))->expireAfter(3600*24);
@vukanac
vukanac / README.md
Created Sep 19, 2016 — forked from mikefrancis/README.md
PSR-2 Build System using Sublime Text
View README.md

PSR-2 Build System using Sublime Text

Installation

Open a new terminal and install Composer:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Once that has finished installing and moved, install the PHP-CS-Fixer Composer package globally:

You can’t perform that action at this time.