Skip to content

Instantly share code, notes, and snippets.

View diegommarino's full-sized avatar

Diego Marino diegommarino

  • Dublin, Ireland
View GitHub Profile
@diegommarino
diegommarino / .vimrc
Last active December 1, 2020 17:01
My vim rc
" Presets
" PLUGINS
call plug#begin('~/.vim/plugged')
" On Mac OS, to copy a whole file to clipboard use '%w !pbcopy'
" Fuzzy Finder
" Needs fzf installed
" 'brew install fzf'
" 'brew install the_silver_searcher'
require "selenium-webdriver"
DEFAULT_TIMEOUT = 20
def setup
driver
end
def select_by_label(id, label, options = {})
reverse_merge(options, how: :id)
@diegommarino
diegommarino / pdf_notes_urls_extract.rb
Last active August 10, 2018 10:47
Extract URLs and Notes from PDFs
# Credits to https://gist.github.com/danlucraft/5277732
require 'pdf-reader'
class Annotations
def initialize(reader, page)
@objects = reader.objects
@page = reader.page(page)
@all_annots = annots_on_page
end
@diegommarino
diegommarino / django_to_heroku.md
Last active April 12, 2018 17:10
Creating a Django sample app and deploying it to Heroku

Deploying a Django app to Heroku

This guide has the objective to show how to build a sample Django app and deploy it to Heroku. We'll go through the following steps:

  • Create a sample app
  • Database configuration
  • Configuring project to deploy to Heroku

I'll not cover how to install Django, Postgresql or configure python, assuming that you already have a configured environment.

<template>
<div id="app">
<app-header/>
<bootstrap-alert v-if="appAlert" :message="appAlert.message" :type="appAlert.type" :dismissable="appAlert.dismissable"/>
<div id="router-content">
<router-view/>
</div>
</div>
</template>
<template>
<div id="bootstrap-alert">
<div class="alert alert-dismissible fade show" :class="typeClass" role="alert">
{{message}}
<button v-if="dismissable === true" type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
</div>
</template>
def checkSum(arr, s)
hashArr = Hash[arr.each_with_index.collect { |v,i| [v,i] }]
puts hashArr
arr.each do |v|
return true unless hashArr[s-v].nil?
end
false
end
puts "Input the array (ex: 1,2,3,4,5)"
@diegommarino
diegommarino / .zshrc
Created April 3, 2018 12:27
Example of function function to create a custom session in iterm2 using applescript syntax.
# Add this function to create a custom session in iterm2 using applescript
iterm-custom-session () {
osascript -e 'tell application "iTerm"
(* set the project path. You can add a bash variable too for more felxibility *)
set projectPath to "your_project_path"
select first window
tell the current window
(* Split first session in two and enter in the project path *)
activate current session
import axios from 'axios'
import router from '@/router'
const namespaced = true
const state = {
token: null,
userId: null,
user: null,
profileId: null,
isStaff: null
tmux new-session \; \
send-keys 'tail -f /var/log/monitor.log' C-m \; \
split-window -v -p 75 \; \
split-window -h -p 30 \; \
send-keys 'top' C-m \; \
select-pane -t 1 \; \
split-window -v \; \
send-keys 'weechat' C-m \;