Skip to content

Instantly share code, notes, and snippets.

View yoterpa's full-sized avatar

Anish Chand yoterpa

  • Srijan
  • New Delhi, India
View GitHub Profile
@yoterpa
yoterpa / parse-server-issue.md
Last active March 14, 2017 20:05
Copy of User class in Parse-Server

Issue Description

I was trying to create a user with just email and password using curl, but I forgot to add underbar before User class in the request. It created another User class, created the user in that class and returned the objectId in response.

What's strange is that Parse-dashboard shows this new User class with copies of all the rows and a few columns, but I couldn't find my newly created user there. I tried to delete this User class, but you have to delete all the rows in a class before deleting it. Just to be safe, I started with just one and as I suspected it deleted the user from the default User class as well.

What I think is either it should not be allowed to create a 'without underbar' versions of the default classes or if it is the dashboard shouldn't link the created class with the default class.

Steps to reproduce

@yoterpa
yoterpa / transparentNavigationBar.m
Created July 7, 2016 09:48
[iOS] transparent navigation bar
UINavigationController *tempNavCont = [[UINavigationController alloc] initWithRootViewController:tempVC];
[tempNavCont.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
tempNavCont.navigationBar.shadowImage = [UIImage new];
tempNavCont.navigationBar.translucent = YES;
tempNavCont.view.backgroundColor = [UIColor clearColor];
tempNavCont.navigationBar.backgroundColor = [UIColor clearColor];
//
// ALiOSDemo7ViewController.m
// PureLayout Example-iOS
//
// Copyright (c) 2014-2015 Tyler Fox
// https://github.com/PureLayout/PureLayout
//
#import "ALiOSDemo7ViewController.h"
#import <PureLayout/PureLayout.h>
@yoterpa
yoterpa / VirtualBox_SharedFolders.md
Last active February 4, 2016 13:34
Using shared-folders in Virtual-Box (if your host operating system is Mac OS X and you have installed Ubuntu as the guest operating system.)

This will install the guest additions and is more or less equivalent to installing via the ISO,

sudo apt-get install virtualbox-guest-utils

Then,

sudo modprobe -a vboxguest vboxsf vboxvideo
@yoterpa
yoterpa / xcode-build-bump.sh
Created December 16, 2015 13:30 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)

App Icons

Create App Icon

Function to quickly create an application icon from 1024px master file.

function mkicns() {
    if [[ -z "$@" ]]; then
        echo "Input file missing"
    else
 filename=${1%.*}

The corrent order of arguments

g++ -o test test.cpp pkg-config --cflags --libs opencv

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

@yoterpa
yoterpa / gist:503b0bcfeb54c55d46ba
Created September 25, 2015 07:16 — forked from spenrose/gist:4539571
Logging macros
// Logging Macros
#ifdef DEBUG
# define DLog(FORMAT, ...) printf("%s %s ~ %s\n", [[[NSDate date] description] UTF8String], __PRETTY_FUNCTION__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String])
#else
# define DLog(...)
#endif
// ALog always displays output regardless of the DEBUG setting
#define ALog(FORMAT, ...) printf("%s %s ~ %s\n", [[[NSDate date] description] UTF8String], __PRETTY_FUNCTION__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String])
@yoterpa
yoterpa / gist:f9cc579ad342cdffe597
Last active September 1, 2015 11:33 — forked from r3econ/gist:9923319
Downloading JSON file using NSURLSession.
// Create a sample URL.
NSURL *url = [NSURL URLWithString:@"http://www.bbc.co.uk/tv/programmes/genres/drama/scifiandfantasy/schedules/upcoming.json"];
// Create a download task.
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
completionHandler:^(NSData *data,
NSURLResponse *response,
NSError *error)
{
if (!error)
@yoterpa
yoterpa / sublime_regex2.md
Last active August 29, 2015 14:27
regex: check if two strings are same

([\d]+), \1((?:\W|$))

^    : Start anchor
(    : Start of capturing group
 \w+ : A word
)    : End of capturing group
\s+  : One or more whitespace
\1   : Back reference to the first word
\b : Word boundary