Skip to content

Instantly share code, notes, and snippets.

View andergmartins's full-sized avatar

Anderson Grüdtner Martins andergmartins

View GitHub Profile
tell application "Finder"
try
set appPath to (path to application "Evernote" as text)
on error
display dialog "Couldn't find Evernote. Is it installed?"
end try
set printPath to (path to "dlib" from user domain as text) & "PDF Services"
make new alias at printPath to appPath with properties {name:"Send PDF to Evernote"}
end tell
<?php
// no direct access
defined('_JEXEC') or die;
// Variables
$doc = JFactory::getDocument();
$user = JFactory::getUser();
$template = 'templates/' . $this->template;
// get html head data
@andergmartins
andergmartins / select2_fixed_widgets.py
Last active August 29, 2015 13:57 — forked from BertrandBordage/gist:8288704
Fix a wrong class name
# WARNING: This is just a workaround. Consider it as a very
# temporary solution if you really need this feature.
from django.utils.safestring import mark_safe
from django_select2.util import convert_to_js_arr
TEMPORARY_ID = 0
@andergmartins
andergmartins / index.html
Last active August 29, 2015 13:56
HTML5 Multiple Files Upload
<html>
<head>
<style type="text/css" media="screen">
input {
display: block;
margin-top: 10px;
}
#modal {
background-color: #affdc2;
@andergmartins
andergmartins / ssh-config-github-multiple-deploy-keys
Last active January 3, 2016 14:39
When using a CI server, like Jenkins, in conjunction with github, you may wish to use multiple deploy keys (github-speak for an rsa key pair that has been assigned to a single repo, rather than a user) to allow Jenkins to pull code from the github repositories
# In the example here, where three repos are used, the idea is to take advantage of ssh's config mechanism
# For use with Jenkins, do the following:
# login to your CI Server
sudo su -s /bin/bash jenkins
cd ~/.ssh/
# then create three key key pairs
ssh-keygen -f id_rsa_project1
# on prompt, set target file to id_rsa_project1
# repeat for id_rsa_project2 and id_rsa_project3
@andergmartins
andergmartins / 0_reuse_code.js
Created October 10, 2013 01:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<form>
<div class="btn-group" data-toggle-name="is_private" data-toggle="buttons-radio" >
<button type="button" value="0" class="btn" data-toggle="button">Public</button>
<button type="button" value="1" class="btn" data-toggle="button">Private</button>
</div>
<input type="hidden" name="is_private" value="0" />
</form>
@andergmartins
andergmartins / cron.helper.php
Created March 1, 2013 17:08
Cron Job Helper - Lock, PID
<?php
/*
* From: http://abhinavsingh.com/blog/2009/12/how-to-use-locks-in-php-cron-jobs-to-avoid-cron-overlaps/
*/
define('LOCK_DIR', '/tmp/');
define('LOCK_SUFFIX', '.lock');
class CronHelper {
# https://www.digitalocean.com/community/articles/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04
sudo apt-get update
sudo apt-get install mysql-server
sudo apt-get install nginx
sudo service nginx start
Ti.App.Properties.setList('DB_queue', []);
Ti.App.Properties.setBool('DB_locked', false);
Ti.App.Properties.setBool('DB_queue_running', false);
Ti.include('db.js', 'examples.js');