Skip to content

Instantly share code, notes, and snippets.

View ferbass's full-sized avatar
:octocat:
ι(`ロ´)ノ

Fernando Bass ferbass

:octocat:
ι(`ロ´)ノ
View GitHub Profile
@ferbass
ferbass / reverse_complement.py
Created May 4, 2020 06:33
Reverse complement of DNA strand using Python
alt_map = {'ins':'0'}
complement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'}
def reverse_complement(seq):
for k,v in alt_map.iteritems():
seq = seq.replace(k,v)
bases = list(seq)
bases = reversed([complement.get(base,base) for base in bases])
bases = ''.join(bases)
for k,v in alt_map.iteritems():
@ferbass
ferbass / patterncount.py
Created May 4, 2020 06:14
pattern count
def PatternCount(Text, Pattern):
count = 0
for i in range(len(Text)-len(Pattern)+1):
if Text[i:i+len(Pattern)] == Pattern:
count = count+1
return count
@ferbass
ferbass / glossary-terms.md
Created August 28, 2019 14:27
Introduction to Self-Driving Cars - Glossary Terms

ACC: Adaptive Cruise Control

A cruise control system for vehicles which controls longitudinal speed. ACC can maintain a desired reference speed or adjust its speed accordingly to maintain safe driving distances to other vehicles.

Ego

A term to express the notion of self, which is used to refer to the vehicle being controlled autonomously, as opposed to other vehicles or objects in the scene. It is most often used in the form ego-vehicle, meaning the self-vehicle.

FMEA: Failure Mode and Effects Analysis

Keybase proof

I hereby claim:

  • I am ferbass on github.
  • I am ferbass (https://keybase.io/ferbass) on keybase.
  • I have a public key ASBIz1bPa8UBMrybqhmZAwxv_qNNUi3ROttgqhpFRc1KkAo

To claim this, I am signing this object:

NSMutableArray *commands = [[NSMutableArray alloc] init];
NSString *characters = @"`1234567890-=qwertyuiop[]asdfghjkl;'zxcvbnm,./";
for (NSInteger i = 0; i < characters.length; i++) {
NSString *input = [characters substringWithRange:NSMakeRange(i, 1)];
/* Caps Lock */
[commands addObject:[UIKeyCommand keyCommandWithInput:input modifierFlags:UIKeyModifierAlphaShift action:@selector(handleCommand:)]];
/* Shift */
[commands addObject:[UIKeyCommand keyCommandWithInput:input modifierFlags:UIKeyModifierShift action:@selector(handleCommand:)]];
/* Control */
@ferbass
ferbass / button.swift
Created May 3, 2016 04:14
Adding a closure as target to a UIButton
import UIKit
extension UIButton {
private func actionHandleBlock(action:(() -> Void)? = nil) {
struct __ {
static var action :(() -> Void)?
}
if action != nil {
@ferbass
ferbass / rounded button.swift
Last active April 26, 2016 03:38
Rounded Button in Swift
import UIKit
class RoundedButton: UIButton {
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
let maskPath = UIBezierPath.init(roundedRect: self.bounds, cornerRadius: 5)
UIColor.clearColor().setFill()
maskPath.fill()
let descriptorFontBody = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleBody)
let descriptionFontBodySize = descriptorFontBody.pointSize;
let bodyFont = UIFont(name: "Zapfino", size: descriptionFontBodySize)
label.font = bodyFont;
UIFontDescriptor *descriptorFontBody = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleHeadline];
CGFloat descriptorFontBodySize = [userHeadLineFont pointSize];
UIFont *bodyFont = [UIFont fontWithName:@"Zapfino" size:descriptorFontBodySize];
label.font = bodyFont;
func didReceiveUIContentSizeCategoryDidChangeNotification(notification: NSNotification)
{
label.font = UIFont.preferredFontForTextStyle(UIFontTextStyleBody)
}