View 8puzzle.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Solves a randomized 8-puzzle using A* algorithm with plug-in heuristics | |
import random | |
import math | |
_goal_state = [[1,2,3], | |
[4,5,6], | |
[7,8,0]] | |
def index(item, seq): |
View gabor_filter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 | |
# cv2.getGaborKernel(ksize, sigma, theta, lambda, gamma, psi, ktype) | |
# ksize - size of gabor filter (n, n) | |
# sigma - standard deviation of the gaussian function | |
# theta - orientation of the normal to the parallel stripes | |
# lambda - wavelength of the sunusoidal factor | |
# gamma - spatial aspect ratio | |
# psi - phase offset |
View Flask-blueprint-with-imported-routes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* |
View ViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] | |
initWithGraphPath:@"me/friends" | |
parameters:nil | |
HTTPMethod:@"GET"]; | |
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, | |
id result, | |
NSError *error) { | |
// Handle the result | |
NSLog(@"%@", result); | |
}]; |
View ViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to list down all the available fonts in iOS | |
for (NSString *fontFamilyName in [UIFont familyNames]) { | |
for (NSString *fontName in [UIFont fontNamesForFamilyName:fontFamilyName]) { | |
NSLog(@"Family: %@ Font: %@", fontFamilyName, fontName); | |
} | |
} |
View ViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert the currency format: 1,000,000 to Rs.10,00,00 | |
// | |
// Initialization | |
NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init]; | |
[currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; | |
[currencyFormatter setCurrencySymbol:@"Rs."]; | |
[currencyFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_IN"]]; | |
NSString *str = [currencyFormatter stringFromNumber:[NSNumber numberWithFloat:price]]; |
View ViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UIStoryboard->UINavigationController->UIViewController | |
// | |
// Initializations | |
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; | |
UINavigationController *controller = (UINavigationController *)[storyboard instantiateViewControllerWithIdentifier:@"identifier"]; | |
SecondViewController *svc = (SecondViewController *)controller.topViewController; | |
// Passing data | |
svc.some_code = self.object.some_code; |
View ViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UIViewController nagivation without the navigation controller. | |
// UIStoryboard->UINavigationController | |
// | |
// Initializations | |
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; | |
SecondViewController *svc = (SecondViewController *)[storyboard instantiateViewControllerWithIdentifier:@"identifierName"]; | |
// Navigation | |
dispatch_async(dispatch_get_main_queue(), ^{ |