Instantly share code, notes, and snippets.

Embed
What would you like to do?
Atom Snippets
# -------------------------------------------------------------------------------
# GENERAL
'.source':
# Main Description Header
'Main Header':
'prefix': 'header'
'body': """
# ================================================================================
#
# CAPITAN: Andrés Bretón, dev@andresbreton.com
# FILE:
# LICENSE:
# USAGE:
# DEPENDENCIES: -
#
# ================================================================================
"""
# Method/Function/Subroutine Descriptive Header
'Method/Function Header':
'prefix': 'subhd'
'body': """
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# input = ();
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# This function takes arguments
#
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# output =
# return = ();
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"""
# Section Divider
'Section Divider':
'prefix': 'divider'
'body': """#--------------------------------------------------------------------------------
# """
# Sub-section Divider
'Sub-section':
'prefix': 'sub-div'
'body': '#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -'
#--------------------------------------------------------------------------------
# PYTHON
'.source.python':
'docstring':
'prefix': 'docstring'
'body': '""" """'
#-------------------------------------------------------------------------------
# PERL
'.source.perl':
# Shebang
'Shebang + Header':
'prefix': 'plshebang'
'body': """#!/usr/bin/env perl
use strict; use warnings; use feature qw(say);
use Getopt::Long; use Pod::Usage;
use FindBin; use lib "$FindBin::RealBin/lib";
use File::Basename qw(dirname);
use Cwd qw(abs_path);
use lib (dirname abs_path $0). "/lib";
"""
# Perl Getopt Long Command Line Options
'Command Line Options':
'prefix': 'clops'
'body': """
use Getopt::Long; use Pod::Usage;
#-------------------------------------------------------------------------------
# COMMAND LINE
my $ = "";
my $usage= "\n\n$0 [options]\n
Options:
-
-
-help Shows this message
\n";
# OPTIONS
GetOptions(
'' =>\$,
'' =>\$,
help =>sub{pod2usage($usage);}
)or pod2usage(2);
checkCLA(); #check command line arguments passed
#-------------------------------------------------------------------------------
# CALLS
"""
# Subroutine Descriptive Header
'Subroutine Header':
'prefix': 'subhd'
'body': """
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# $input = ();
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# This function takes arguments
#
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# $output =
# $return = ();
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"""
# Perl Module Header
'Perl Module Header':
'prefix': 'pm'
'body': """
package $PACKAGENAME;
use Exporter qw(import);
our @ISA = qw(Exporter);
our @EXPORT = qw(); # functions exported by default
our @EXPORT_OK = qw(); # functions for explicit export
use strict; use warnings; use diagnostics; use feature qw(say);
use Carp;
# ==============================================================================
#
# CAPITAN:
# FILE:
# LICENSE:
# USAGE:
# DEPENDENCIES:
#
# ==============================================================================
=head1 NAME
$PACKAGENAME - package
=head1 SYNOPSIS
Creation:
use $PACKAGENAME;
=head1 DESCRIPTION
=head1 EXPORTS
=head2 Default Behaviors
Exports $SUB subroutine by default
use $PACKAGENAME;
=head2 Optional Behaviors
$PACKAGENAME::;
=head1 FUNCTIONS
=cut
#-------------------------------------------------------------------------------
# MAIN
=head2 $SUB
Arg [1] :
Example :
Description :
Returntype :
Status : Stable
=cut
sub $SUB {
my ($) = @_;
return;
}
=head1 COPYRIGHT AND LICENSE
Andrés Bretón ©
[LICENSE]
=head1 CONTACT
Please email comments or questions to Andrés Bretón, <dev@andresbreton.com>
=head1 SETTING PATH
If PERL5LIB was not set, do something like this:
use FindBin; use lib "$FindBin::RealBin/lib";
This finds and uses subdirectory 'lib' in current directoy as library location
=cut
1;
"""
# Plain Old Documentation (POD)
'Plain Old Documentation':
'prefix': 'pod'
'body': """
=head1 NAME
$PACKAGENAME - package
=head1 SYNOPSIS
Creation:
use $PACKAGENAME;
=head1 DESCRIPTION
=head1 EXPORTS
=head2 Default Behaviors
Exports $SUB subroutine by default
use $PACKAGENAME;
=head2 Optional Behaviors
$PACKAGENAME::;
=head1 FUNCTIONS
=cut
"""
# In-line Subroutine Documentation
'Sub Documentation':
'prefix': 'subdoc'
'body': """
=head2 $SUB
Arg [1] :
Example :
Description :
Returntype :
Status : Stable
=cut
"""
# POD COPYRIGHT
'POD Copyright& License':
'prefix': 'copyright'
'body': """
=head1 COPYRIGHT AND LICENSE
Andrés Bretón (C)
[LICENSE]
=head1 CONTACT
Please email comments or questions to Andrés Bretón, me@andresbreton.com
=head1 SETTING PATH
If PERL5LIB was not set, do something like this:
use FindBin; use lib "$FindBin::RealBin/lib";
This finds and uses subdirectory 'lib' in current directoy as library location
=cut
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment