Skip to content

Instantly share code, notes, and snippets.

@bithavoc
bithavoc / asset_helper.rb
Created October 23, 2017 01:42 — forked from jeremyruppel/asset_helper.rb
Inline asset helpers for middleman.
module AssetHelper
##
# Renders a stylesheet asset inline.
def inline_stylesheet( name )
content_tag :style do
sprockets[ "#{name}.css" ].to_s
end
end
@bithavoc
bithavoc / challenge.sh
Created January 31, 2017 04:07
Letsencrypt manual DNS challenge via TXT records
sudo certbot certonly -d vault.reeactr.com --manual --preferred-challenges dns-01
@bithavoc
bithavoc / eureka_swift_3:composable_search_row.swift
Last active November 15, 2018 13:59
Eureka Swift 3 Composable Search Row
open class _ComposableSearchablePushRow<T: Equatable, Cell: CellType> : TableSelectorRow<Cell, ComposableSearchableViewController<T>> where Cell: BaseCell, Cell: TypedCellType, Cell.Value == ComposableSearchableItem<T>, T: SearchableItem, T: CustomStringConvertible {
public required init(tag: String?) {
super.init(tag: tag)
onCreateControllerCallback = { [weak self] _ in
let controller = ComposableSearchableViewController<T>()
controller.searchPlaceholder = self?.searchPlaceholder
return controller
}
@bithavoc
bithavoc / postgres-notify-trigger.sql
Last active February 2, 2019 09:31
I used this trigger to notify table changes via NOTIFY (migrating off RethinkDB)
CREATE OR REPLACE FUNCTION notify_trigger() RETURNS trigger AS $$
DECLARE
channel_name varchar DEFAULT (TG_TABLE_NAME || '_changes');
BEGIN
IF TG_OP = 'INSERT' THEN
PERFORM pg_notify(channel_name, '{"id": "' || NEW.id || '"}');
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
PERFORM pg_notify(channel_name, '{"id": "' || OLD.id || '"}');
@bithavoc
bithavoc / gist:488bb9638383a453359d
Created November 16, 2015 17:44
-Weverything at it's best
- WARN | source: Git sources should specify a tag.
- ERROR | xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
- ERROR | xcodebuild: Target Support Files/RMErrors/RMErrors-prefix.pch:2:1: error: treating #import as an import of module 'UIKit' [-Werror,-Wauto-import]
- ERROR | xcodebuild: RMErrors/RMErrors/RMErrorCodeDefinition.h:9:1: error: treating #import as an import of module 'Foundation' [-Werror,-Wauto-import]
- ERROR | xcodebuild: RMErrors/RMErrors/RMErrorCodeBoundary.h:9:1: error: treating #import as an import of module 'Foundation' [-Werror,-Wauto-import]
- ERROR | xcodebuild: RMErrors/RMErrors/RMErrorDescription.h:9:1: error: treating #import as an import of module 'Foundation' [-Werror,-Wauto-import]
- ERROR | xcodebuild: RMErrors/RMErrors/RMErrorCodeRangeBoundary.h:9:1: error: treating #import as an import of module 'Foundation' [-Werror,-Wauto-import]
- ERROR | [iOS] xcodebuild: RMErrors/RMErrors/RMErrorCodeDefinit
@bithavoc
bithavoc / tls-client
Last active September 22, 2015 14:22 — forked from michaljemala/tls-client.go
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@bithavoc
bithavoc / keybase.md
Created April 7, 2015 19:03
keybase.md

Keybase proof

I hereby claim:

  • I am bithavoc on github.
  • I am bithavoc (https://keybase.io/bithavoc) on keybase.
  • I have a public key whose fingerprint is 5E3B 423F 90A8 0E0D C08D 927A FC92 26CA EF7B 7CDE

To claim this, I am signing this object:

@bithavoc
bithavoc / example_rocka.cpp
Created January 21, 2015 22:58
da fuq is rocka lang
// example of Rocka: An interpreted, duck-typed, Object-Oriented and Functional programming language
// Example source code of Rocka
// #$RKROOT/lib/standard/io.rk
//
namespace Standard.IO;
// defined in standard_io.cpp
extern public print(msg string) bool;
@bithavoc
bithavoc / NSString+UnicodeString.mm
Created January 18, 2015 17:37
Convert NSString to icu::UnicodeString back and forth
//
// NSString+UnicodeString.m
//
// Created by Johan Hernandez on 1/18/15.
// Copyright (c) 2015 Bithavoc.io - All rights reserved.
//
#import "NSString+UnicodeString.hh"
#include <string>
CREATE TABLE IF NOT EXISTS events (
id TEXT,
name TEXT,
time TIMESTAMP,
state TEXT,
context map<text, text>,
account TEXT,
email TEXT,
visitor TEXT,
device TEXT,