This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
package javaapplication1; | |
import java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.util.regex.Matcher; |
This file contains hidden or 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
#!/bin/bash | |
while IFS='' read -r line || [[ -n "$line" ]]; do | |
wget $line | |
done < "$1" |
This file contains hidden or 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
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
This file contains hidden or 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
server { | |
listen 80; | |
root /var/www/cms/public; | |
index index.php index.html index.htm; | |
charset utf-8; | |
location / { | |
try_files $uri $uri/ /index.php?$args; |
This file contains hidden or 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 8.1 | |
sudo apt install software-properties-common | |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get -y install php8.1-cli | |
# Composer | |
cd ~ | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php composer-setup.php | |
sudo mv composer.phar /usr/local/bin/composer |