Skip to content

Instantly share code, notes, and snippets.

View Sophrinix's full-sized avatar

Andrew McElroy Sophrinix

View GitHub Profile
@kwk
kwk / Makefile
Last active March 17, 2024 22:54
Compiling with Address Sanitizer (ASAN) with CLANG and with GCC-4.8
.PHONY: using-gcc using-gcc-static using-clang
using-gcc:
g++-4.8 -o main-gcc -lasan -O -g -fsanitize=address -fno-omit-frame-pointer main.cpp && \
ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) ./main-gcc
using-gcc-static:
g++-4.8 -o main-gcc-static -static-libstdc++ -static-libasan -O -g -fsanitize=address -fno-omit-frame-pointer main.cpp && \
ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) ./main-gcc-static
@alganet
alganet / exists.cmd
Last active November 19, 2018 14:21
sh/bat hybrid that checks available commands. Despite its hackish look, it was tested under Windows XP, wine, ksh, zsh, dash and bash.
: ::\
@echo off
rem () ( command -v $1 >/dev/null 2>&1; return $? )
rem : "Usage sh: $ sh exists.cmd ls && echo exists "
rem : "Usage bat: > exists.cmd notepad "
rem : " > echo %ErrorLevel% "
rem $1 <<REM
:exists

Embedded Titanium

Hi Jeff and Tony! Here's the getting started guide for the fantasy Titanium component I want you to build for me :)

About Embedded Titanium

Embedded Titanium allows native iOS developers to rapidly build part or all of their mobile application using simple JavaScript APIs. Use a TitaniumViewController just like you would a UIViewController in your iOS app to mix and match pure native views and JavaScript-driven Titanium views. It's less filling AND it tastes great!

Installation

Embedded Titanium is distributed through Cocoapods. To install, add the following to your Podfile:

@FiloSottile
FiloSottile / 32.asm
Last active May 16, 2024 19:56
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@dmitshur
dmitshur / gist:6927554
Last active September 17, 2023 07:35
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@SabretWoW
SabretWoW / rspec_model_testing_template.rb
Last active May 28, 2024 17:41
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@crosson
crosson / ssh.rb
Last active December 17, 2015 02:19
Tool I use to log into cisco or F5 devices.
require 'rubygems'
require 'net/ssh'
require 'net/ssh/telnet'
class SSH
attr_accessor :errors
def initialize(creds)
begin
@ssh_session = Net::SSH.start(creds[:host], creds[:user], :password => creds[:password], :keys => [])
@mstepanov
mstepanov / app.js
Created March 19, 2013 23:19
Titanium ListView Examples
var rootWin = Ti.UI.createWindow();
var navGroup = Ti.UI.iPhone.createNavigationGroup({
window: rootWin
});
var button = Ti.UI.createButton({
title: 'Open ListView Tests'
});
button.addEventListener('click', function() {
openTestsWindow();
});
@aaronksaunders
aaronksaunders / app_snippet.js
Last active July 11, 2020 14:07
One way to do bulk updates and deletes with Appcelerator Alloy Collections
// add all items to collection
Alloy.Collections.Fugitive.reset([{
"name" : "Jeff Haynie"
}, {
"name" : "Nolan Wright"
}, {
"name" : "Don Thorp"
}, {
"name" : "Marshall Culpepper"
}, {
@dbankier
dbankier / TiUIAlertDialogProxy.mm
Last active March 17, 2016 06:12
Adds `keyboardType` and `hintText` to PLAIN_TEXT_INPUT AlertDialog
// For SDK 3.0.0 modify TiUIAlertDialogProxy.m at around line 124 to look like this:
if ([TiUtils isIOS5OrGreater])
{
int style = [TiUtils intValue:[self valueForKey:@"style"] def:UIAlertViewStyleDefault];
[alert setAlertViewStyle:style];
if (style == UIAlertViewStylePlainTextInput) {
int keyboardType = [TiUtils intValue:[self valueForKey:@"keyboardType"] def: UIKeyboardTypeDefault];
NSString *hintText = [TiUtils stringValue:[self valueForKey:@"hintText"]];
UITextField *alertTextField = [alert textFieldAtIndex:0];