Skip to content

Instantly share code, notes, and snippets.

Ivan Zezyulya ivanzoid

Block or report user

Report or block ivanzoid

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ivanzoid
ivanzoid / setupGOROOT.sh
Created Aug 26, 2012
Aumatically setup $GOROOT in HomeBrew
View setupGOROOT.sh
#
# Place this code to your .profile, .bashrc, .bash_profile or whatever
#
program_exists () {
type "$1" &> /dev/null ;
}
if program_exists go; then
@ivanzoid
ivanzoid / gist:8353510
Last active Dec 28, 2017
Insert & delete rows in UITableView with animation
View gist:8353510
NSMutableArray *indexPathsToDelete = [NSMutableArray new];
for (Object *object in newObjects)
{
if (![currentObjects containsObject:object]) {
int row = [newObjects indexOfObject:object];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
[indexPathsToDelete addObject:indexPath];
}
}
View gist-update.go
//usr/bin/env go run $0 -- "$@"; exit $?
//
// Use this script to maintain a set of github gists as files.
//
// Usage:
// - install 'gist' program (https://github.com/defunkt/gist)
// - make sure you have Go (https://golang.org) installed
// - make a folder somewhere where you want to store your gists.
// - place gist-update.go (https://gist.github.com/ivanzoid/611177bbd3f5cb0604810f07080757b3#file-gist-update-go) to this folder
View Bash compare strings.sh
# Bash compare strings
if [ "$x" = "valid" ]; then
echo "x has the value 'valid'"
fi
if [ "$x" != "valid" ]; then
echo "x has the value 'valid'"
fi
View Bash program exists.sh
program_exists () {
type "$1" &> /dev/null ;
}
if ! program_exists foo; then
echo "Please install foo"
exit 2
fi
View Bash script template with arguments.sh
#!/bin/bash -ex
usage()
{
local PROG_NAME=`basename $0`
echo "Usage: $PROG_NAME params"
}
main()
{
View Bash test file exists.sh
if [ -f "$file" ]; then
echo "$file found."
fi
if [ ! -f "$file"]; then
echo "$file not found."
fi
View Golang debug log.go
package main
import (
"fmt"
"os"
)
func dlog(format string, args ...interface{}) {
fmt.Fprintf(os.Stderr, format, args...)
fmt.Fprintf(os.Stderr, "\n")
You can’t perform that action at this time.