Skip to content

Instantly share code, notes, and snippets.

View aliharis's full-sized avatar
💀

haris aliharis

💀
View GitHub Profile
@aliharis
aliharis / wordpress_featured_image.php
Created October 2, 2012 07:42
Wordpress Theme: Featured Image / Post Thumbnail
@aliharis
aliharis / clearfix.css
Created October 5, 2012 08:17
CSS Clearfix Hack
/* clearfix hack */
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix {
@aliharis
aliharis / getYTEmbedUrl.php
Created November 15, 2012 15:11
Get YouTube Embed URL
<?php
/**
* Get YouTube Embed URL
* @author Ali Haris (cyberatoll.com)
*/
/**
* @param url
* @return youtube embed url
@aliharis
aliharis / stdio.h
Created November 19, 2012 18:14
Standard Input Output for C (Header)
/* stdio.h
Definitions for stream input/output.
Copyright (c) Borland International 1987,1988,1990,1991
All Rights Reserved.
*/
#ifndef __STDIO_H
#define __STDIO_H
/*
** 2/12/2012
** Ali Haris
*/
/*
This is a js which identifies
the viewport width and assigns
to the websites container.
*/
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 */
@aliharis
aliharis / OrderedBehavior.php
Created March 8, 2014 08:24
OrderedBehavior for CakePHP 2.x
<?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
@aliharis
aliharis / formatTelephoneNumber.php
Created April 13, 2014 07:42
Format Telephone Number with PHP
<?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]}";
}
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) {
@aliharis
aliharis / date.c
Created June 22, 2014 18:49
Convert UNIX Timestamp to NSDate and to user's local timezone
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);