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
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
bool updateRecord(string currentRecord, string newRecord) | |
{ | |
ifstream inFile("Data.txt"); // File to read from | |
ofstream outFile("Temp.txt", ios::trunc); // Temporary file | |
if(!inFile || !outFile) { |
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
<?php | |
/** | |
* Shortcode: [listpages] | |
* @return title of current page followed by child pages | |
*/ | |
function listpages_func() { | |
global $post; | |
$html = ''; |
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
<?php | |
function getPagesInHierachy($post, $options = null) { | |
// default args for wp_list_pages (show only top level pages) | |
$args = array('depth' => 1); | |
if(is_page()) { | |
// get top level page ID from current page | |
$parents = get_post_ancestors( $post->ID ); | |
$parent = ($parents) ? $parents[count($parents)-1]: $post->ID; |
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
NSDate *dateTraded = [NSDate dateWithTimeIntervalSince1970:1408636621]; | |
NSDateFormatter *_formatter=[[NSDateFormatter alloc]init]; | |
[_formatter setLocale:[NSLocale currentLocale]]; | |
[_formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss ZZZ"]; | |
NSString *_date=[_formatter stringFromDate:dateTraded]; | |
NSLog(@"%@", _date); | |
NSDate *date1 = _date; |
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
NSDate *dateTraded = [NSDate dateWithTimeIntervalSince1970:1408636621]; | |
NSDateFormatter *_formatter=[[NSDateFormatter alloc]init]; | |
[_formatter setLocale:[NSLocale currentLocale]]; | |
[_formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; | |
NSString *_date=[_formatter stringFromDate:dateTraded]; | |
NSLog(@"Final time: %@", _date); |
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
ACAccountStore *accountStore = [[ACAccountStore alloc] init]; | |
ACAccountType *facebookAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook]; | |
id options = @{ | |
ACFacebookAppIdKey: @"403376439767549", | |
ACFacebookPermissionsKey: @[ @"email", @"read_friendlists"], | |
ACFacebookAudienceKey: ACFacebookAudienceFriends | |
}; | |
[accountStore requestAccessToAccountsWithType:facebookAccountType | |
options:options | |
completion:^(BOOL granted, NSError *error) { |
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
<?php | |
function formatTelephoneNo($phone_number, $country_code = false) | |
{ | |
$cleaned = preg_replace('/[^[:digit:]]/', '', $phone_number); | |
if ($country_code) { | |
preg_match('/(\d{3})(\d{3})(\d{4})/', $cleaned, $matches); | |
return "({$matches[1]}) {$matches[2]} {$matches[3]}"; | |
} |
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
<?php | |
/** | |
* OrderedBehavior | |
* | |
* @developer Alexander Morland ( aka. alkemann) | |
* @license MIT | |
* @version 2.1 | |
* @modified 27. august 2008 | |
* | |
* This behavior lets you order items in a very similar way to the tree |
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 java.util.Arrays; | |
import java.util.Scanner; | |
/** | |
* Fibonacci Number Generator | |
* @author haris | |
*/ | |
public class Fibonacci { | |
public static void main(String args[]) { | |
/** Initialize the scanner */ |
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
/* | |
** 2/12/2012 | |
** Ali Haris | |
*/ | |
/* | |
This is a js which identifies | |
the viewport width and assigns | |
to the websites container. | |
*/ |