Skip to content

Instantly share code, notes, and snippets.

View aclima93's full-sized avatar
💭
Including Bugs

António Lima aclima93

💭
Including Bugs
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@rgov
rgov / debruijn.py
Last active November 14, 2023 07:37
de Bruijn sequence generator
def deBruijn(n, k):
'''
An implementation of the FKM algorithm for generating the de Bruijn
sequence containing all k-ary strings of length n, as described in
"Combinatorial Generation" by Frank Ruskey.
'''
a = [ 0 ] * (n + 1)
def gen(t, p):
@dblock
dblock / failures_formatter.rb
Created May 4, 2012 19:52
RSpec tests broken up into suites with retry.
# inspired by https://github.com/rspec/rspec-core/pull/596
require 'rspec/core/formatters/base_formatter'
module RSpec
module Core
module Formatters
class FailuresFormatter < BaseFormatter
def dump_failures
return if failed_examples.empty?
@sharonbn
sharonbn / SslUtil.java
Last active August 21, 2022 05:48
SSL/TLS connection from Eclipse Paho Java client to mosquitto MQTT broker
import java.io.*;
import java.nio.file.*;
import java.security.*;
import java.security.cert.*;
import javax.net.ssl.*;
import org.bouncycastle.jce.provider.*;
import org.bouncycastle.openssl.*;
public class SslUtil
@kyleclegg
kyleclegg / InvalidTextFields
Last active May 28, 2024 15:02
Marks invalid UITextFields red in iOS. If valid, restores original border.
#import <QuartzCore/QuartzCore.h>
// Form validation. You'll probably place this in your buttonClicked action
if ([textField.text isEqualToString:@""]) // checks if field is empty, add other form validation here
{
textField.layer.cornerRadius = 8.0f;
textField.layer.masksToBounds = YES;
textField.layer.borderColor = [[UIColor redColor] CGColor];
textField.layer.borderWidth = 1.0f;
}
@tomas-stefano
tomas-stefano / Capybara.md
Last active May 21, 2024 02:09
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active June 29, 2024 03:40
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@evansobkowicz
evansobkowicz / touch_id.rb
Created April 4, 2015 19:56
RubyMotion Touch ID
# Call touch_id_authenticate
def touch_id_authenticate
context = LAContext.alloc.init
auth_error = nil
reason = 'Authenticate using your fingerprint'
if context.canEvaluatePolicy(LAPolicyDeviceOwnerAuthenticationWithBiometrics, error: auth_error)
context.evaluatePolicy(LAPolicyDeviceOwnerAuthenticationWithBiometrics, localizedReason: reason, reply: lambda do |success, error|
@tahmidsadik
tahmidsadik / purgeAndroid.txt
Created September 19, 2015 18:47
How to completely remove Android Studio from Mac OS X
How to Completely Remove Android Studio
Execute these commands from the terminal
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
@iby
iby / Playground.swift
Last active June 29, 2020 20:45
Block / method / function comparison in Swift
import Foundation
// Some interesting observations on block comparing. Apparently swift nor objective c don't allow comparing closures
// due to the complexity of the process and because of compiler optimisations… bla bla. But it seems to be possible
// to do this using conventions blocks, aka the objective c ones that can be cast as objects. The interesting part
// is how swift freely casts SwfBlock to ObjBlock, yet in reality two casted SwfBlock blocks will always be different
// values, while ObjBlocks won't. When we cast ObjBlock to SwfBlock, the same thing happens to them, they become two
// different values. So, in order to preserve the reference, this sort of casting should be avoided.
typealias SwfBlock = () -> ()