Skip to content

Instantly share code, notes, and snippets.

@Lexty
Lexty / bash.sh
Created February 21, 2018 10:38 — forked from hugocf/bash.sh
Template for interactive bash scripts: supports command line options with values; prompts for any missing parameters/arguments.
#!/usr/bin/env bash
# Created by Hugo Ferreira <[email protected]> on isoD.
# Copyright (c) 2012 Mindclick. All Rights Reserved.
# Licensed under the BSD License: http://creativecommons.org/licenses/BSD
readonly BASEDIR=$(cd "$(dirname "$0")" && pwd) # where the script is located
readonly CALLDIR=$(pwd) # where it was called from
readonly STATUS_SUCCESS=0 # exit status for commands
# Script configuration
@Lexty
Lexty / Dockerfile.golang
Last active May 12, 2016 11:22
Makefile for golang projects
FROM golang:1.6.2
MAINTAINER Alexandr Medvedev <[email protected]>
RUN go get github.com/golang/lint/golint
ADD . /go/src/github.com/user/project
RUN cd /go/src/github.com/user/project && go get ./...
if ($newGame) $resources->free();
$s = FILEANAME + 3;
setLocation(); load(s);
$loadDiaog->process();
try { setGamesColor(RED); }
catch(Exception $e) { reset(); }
while($notReady) { $objects->make();
if ($resourceNotFound) break; }
@Lexty
Lexty / common.js
Created February 4, 2016 11:53
Some JavaScript extensions
if (!String.prototype.ucFirst) {
(function() {
String.prototype.ucFirst = function() {
var str = this;
if (str.length) {
str = str.charAt(0).toUpperCase() + str.slice(1);
}
return str;
};
})();
@Lexty
Lexty / hash.js
Last active February 4, 2016 11:50
JavaScript class for manage parameters in hash part of URL
/**
* @param {{}} [options]
* @constructor
*/
var Hash = function (options) {
options || (options = {});
var hash = options.hasOwnProperty('hash') ? options.hash : window.location.hash;
this.options = _.defaults(options, {
delimiter: '',
@Lexty
Lexty / n2dissite
Created June 19, 2014 10:13
nginx virtual host management
#!/bin/bash
VHOSTEN="/etc/nginx/sites-enabled/"
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]
then
echo 'Usage: n2dissate VHOST'
echo 'Disables Nginxs virtualhost VHOST.'
echo -e ' -h, --help\tDisplay this help'
exit 0