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
extension UInt { | |
func withZeroes(digits: UInt) -> String { | |
guard digits > 1 && Decimal(self) < pow(10, Int(digits - 1)) else { | |
return String(describing: self) | |
} | |
return "0" + self.withZeroes(digits: digits - 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
<?php | |
$posts_query = new WP_Query(['posts_per_page' => -1]); | |
$images_query = new WP_Query([ | |
'post_type' => 'attachment', | |
'post_mime_type' => 'image', | |
'post_status' => 'inherit', | |
'posts_per_page' => -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
import Foundation | |
extension NSObjectProtocol { | |
func configure(closure: (Self) -> ()) -> Self { | |
closure(self) | |
return self | |
} | |
} |
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
import Foundation | |
extension Array { | |
func random() -> Element { | |
return self[Int(arc4random_uniform(UInt32(self.count)))] | |
} | |
} |
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
// | |
// main.c | |
// (c) 2016 Akio Yasui | |
// | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
#include <unistd.h> | |
#include <stdio.h> |
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
// | |
// Graph.swift | |
// CoreMesh | |
// | |
// Created by Akio Yasui on 10/24/15. | |
// Copyright © 2015 Akio Yasui. All rights reserved. | |
// | |
import Foundation |
NewerOlder