Skip to content

Instantly share code, notes, and snippets.

View aapis's full-sized avatar
🐝

Яyan Priebe aapis

🐝
View GitHub Profile
@aapis
aapis / Default (Linux).sublime-keymap
Last active April 21, 2016 16:17
My Sublime Text 2 configuration files. Gisted because otherwise I will forget what it is.
[
{ "keys": ["ctrl+shift+a"], "command": "prompt_add_folder" }
]
#!/bin/bash
# Requirements: sed, grep, curl, pkill
# User configuration
LOCAL_INSTALL="/usr/lib/sublime-text-2" # Must be user-writable
REPO="dev" # "dev" for dev releases, or "2" for beta releases
TARGET_BUILD="Linux 32 bit" # can be one of "Windows", "Windows 64 bit", "OS X", "Linux 32 bit", "Linux 64 bit"
# Check if sublime text is running
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", function(){
jQuery(".upme-main").each(function(){
jQuery(this).appendTo(jQuery(this).previousSibling());
});
});
</script>
@aapis
aapis / center_geo.js
Last active August 29, 2015 14:02
Determine the center point of multiple geographical locations in JS
var Map = function(){}
/**
* Calculate the Lat/Lng centerpoint of several Google Maps markers
* Based on: https://gist.github.com/amites/3718961
* @param {array} latlngpoints
* @return {Object}
*/
Map.prototype.calculateCenterPoint = function(latlngpoints){
var x = 0,
@aapis
aapis / add_to_bash_profile.sh
Last active August 29, 2015 14:22
Open a bunch of files in a new Sublime Text window
open_files(){/path/to/sublime_open_files_in_new_window.rb ${@}}
# Usage
open_files test.rb main.c load.php
@aapis
aapis / build.sh
Created December 15, 2015 18:42
Symfony test/build commands (for use in local development)
# Really simple wrappers for running PHPUnit and testing your app's endpoints
# Usage
# run_phpunit Path/To/Bundle
run_phpunit(){
local bundle=$1
local config="app/phpunit.xml.dist"
if [ -f $config ]
then
@aapis
aapis / note.yml
Last active December 16, 2015 23:40
A YAML definition file for creating an Evernote stack using Evertils
title: Derping
body: This is the body
parent: nil
@aapis
aapis / new_company_bootstrap.rb
Created December 22, 2015 22:24
Sample app using Evertils::Common project
require 'evertils/common'
# create new folder structure
stack = Evertils::Common::Entity::Stack.new
stack.create_from_yml('./stack.yml')
@aapis
aapis / canleave.rb
Created April 15, 2016 20:06
Check if there are any uncommitted changes in your working directories at the end of the day (or, whenever)
#! /usr/bin/ruby
require 'notifaction'
require 'pathname'
def update(path)
Dir.chdir(path)
print_successes = false
resp = `git status -s`.size
@aapis
aapis / post-receive.sh
Created April 15, 2016 22:03
post-receive hook for automatic git deployments
#!/home/git/.rvm/rubies/ruby-2.3.0/bin/ruby
puts "Hello world!"
# 1. Read STDIN (Format: "from_commit to_commit branch_name")
from, to, branch = ARGF.read.split " "
# 2. Only deploy if master branch was pushed
if (branch =~ /master$/) == nil
puts "Received branch #{branch}, not deploying."