This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import sys | |
sys.path.append('PATH') # noqa | |
from module_name import Module_name | |
from test_tools import test_name | |
from pprint import pprint #noqa | |
class TestUM(unittest.TestCase): | |
def setUp(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#stop() - alerts about fatal error | |
stop("cant create file") | |
#take only unique values from vector | |
vect<-unique(vect) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#initialize named vector | |
vect<-c("a param 1"=1,"a param 2"=2,"a named param 3"= 6) | |
#show vector names | |
names(vect) | |
#make vector unnamed | |
unname(vect) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DATA FRAME OPERATIONS IN R | |
# Create data frame | |
# A dataset is ~ table (list of vectors) | |
id <- c(1,2,3) | |
name <- c("John", "Kirk", "AJ") | |
age <- c(21,27,18) | |
employees <- data.frame(ID=id, Name=name, Age=age) | |
employees |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package PackageName; | |
sub new { | |
my ($class, $args) = @_; | |
my $self = { | |
attr1 => $args->{attr1} || 'some_template_conent', | |
attr2 => $args->{attr2} || 1, | |
attr3 => $args->{attr3} || 1, | |
}; | |
#more code here if u want |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub new | |
{ | |
my $class = shift; | |
my %params = @_; | |
# | |
#some code here | |
# | |
my $self = $class->SUPER::new(%params); | |
$class = ref $class if ref $class; | |
bless $self, $class; |