Skip to content

Instantly share code, notes, and snippets.

@aloyr
aloyr / clean_code.md
Created November 19, 2022 05:36 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@aloyr
aloyr / workflow.gdsl
Created July 18, 2017 08:06 — forked from gclayburg/workflow.gdsl
Jenkins workflow plugin groovy code completion support for IntelliJ IDE
/*
Author: Gary Clayburg
This file allows IntelliJ IDEA to perform basic syntax checking and code completion for
Jenkins workflow groovy scripts. https://github.com/jenkinsci/workflow-plugin
These methods are supported
sh
readFile
node
echo
@aloyr
aloyr / SCSS.md
Created July 17, 2017 12:19 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@aloyr
aloyr / ssh-agent-snippets.sh
Created May 2, 2017 10:34 — forked from alexras/ssh-agent-snippets.sh
Bash snippets to automatically start and stop an ssh-agent process on login and logout
#!/bin/bash
## in .bash_profile
SSHAGENT=`which ssh-agent`
SSHAGENTARGS="-s"
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
eval `$SSHAGENT $SSHAGENTARGS`
trap "kill $SSH_AGENT_PID" 0
fi
@aloyr
aloyr / click_as.bml
Created March 4, 2017 00:07 — forked from wheeyls/click_as.bml
BigMachines SOAP Calls
/**
* param {String} sessionId
* param {String} bs_id
* param {String} sitename
* param {String} action_var_name
* param {String [][] } attr sets of attributes to set. Format: [[docnum, varname, value], [docnum, varname, value]...]
* param {String} error_string
*
* return {String} the soap response
*/
// Ensure url has 'www' and uses SSL
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) && ($_SERVER['PANTHEON_ENVIRONMENT'] === 'live') &&
(php_sapi_name() != "cli")) {
$do_redirect = FALSE;
$url_chunks = explode('.', $_SERVER['HTTP_HOST']);
if ($url_chunks[0] != 'www') {
array_unshift($url_chunks, 'www');
$do_redirect = TRUE;
}
if (strtolower($_SERVER['HTTPS']) != 'on') {
@aloyr
aloyr / uri.js
Created February 23, 2016 21:04 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@aloyr
aloyr / gist:d017880a7be5ecf78b56
Created October 9, 2015 06:12 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat