View vimrc
" Inspired from https://dougblack.io/words/a-good-vimrc.html
" Enable syntax colors
syntax enable
" Set line numbers
set number
set relativenumber
" Set tabs and spaces
View distance.js
// Point a1
// Point a2
let dx = a2.x - a1.x;
let dy = a2.y - a1.y;
let distance = Math.sqrt(dx*dx + dy*dy);
View loop.js
// Increase until a range is met then start again:
let range = 10;
let x = (x + 1) % range;
View Cache.js
/**
* This snippet is now a small library!
* @link https://github.com/jabranr/js-memcache
*/
View .gitignore_global
.rsync_cache
.vagrant
*~
Guardfile
*.swp
.idea
.DS_Store?
.DS_Store
ehthumbs.db
Icon?
View toggle-multiple-buttons-with-different-text.js
$.fn.extend({
disableCta: function() {
this.prop('disabled', true);
// or use your own class
this.addClass('btn--disabled');
// retain current text of the CTA in custom data attribute
// Used html() assuming it is a <button> element
this.attr('data-value', this.html());
View BaseEntity.php
<?php
namespace Foo\Bar\Entity;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping as ORM;
/**
* BaseEntity
*
View prepare-commit-msg.sh
# Save in .git/hooks/prepare-commit-msg
#
# This means that current branch was branched
# out from JIRA/Bitbucket and has a JIRA
# ticket number in its name.
JIRA=$(cat .git/HEAD | grep -Eo "[A-Z]+-[0-9]+")
echo "$JIRA" >> "$1"
View sublime_custom_getter_setter.py
# Save the file to "{Sublime Packages}/PHP Getters and Setters/user_templates.py"
# Then add following "user config" in Sublime Text:
#
# {
# "registerTemplates" : [ "customTemplate" ],
# "template" : "customTemplate"
# }
#
# Restart Sublime Text
#
View .editorconfig
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true