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 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")
View Golang file exists.go
package main
import "os"
func fileExists(reqFilePath string) bool {
_, err := os.Stat(reqFilePath)
exists := false
if err == nil {
exists = true
} else {
View Golang interface conversions.go
package main
import "strconv"
func interfaceToFloat(value interface{}) float64 {
if value == nil {
return 0.0
}
switch typedValue := value.(type) {
case float64:
View Golang iterate files.go
package main
import (
"log"
"os"
"path/filepath"
)
func main() {
searchDir, err := os.Getwd()
View Golang mysql -B output processing.go
package main
import (
"bufio"
"log"
"os"
"strings"
)
func main() {
View Golang program with single argument.go
package main
import (
"fmt"
"os"
"flag"
"path/filepath"
)
func usage() {
You can’t perform that action at this time.