Skip to content

Instantly share code, notes, and snippets.

View akkyie's full-sized avatar

Akio Yasui akkyie

View GitHub Profile
@akkyie
akkyie / Graph.swift
Created November 18, 2015 07:54
Graph.swift
//
// Graph.swift
// CoreMesh
//
// Created by Akio Yasui on 10/24/15.
// Copyright © 2015 Akio Yasui. All rights reserved.
//
import Foundation
//
// main.c
// (c) 2016 Akio Yasui
//
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
#include <stdio.h>
import Foundation
extension Array {
func random() -> Element {
return self[Int(arc4random_uniform(UInt32(self.count)))]
}
}
import Foundation
extension NSObjectProtocol {
func configure(closure: (Self) -> ()) -> Self {
closure(self)
return self
}
}
<?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,
]);
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)
}
}

Keybase proof

I hereby claim:

  • I am akkyie on github.
  • I am akkyie (https://keybase.io/akkyie) on keybase.
  • I have a public key ASDgjjWxhAHPALmC9WROabnuPheUwItBj2UlRbB3SJaUaAo

To claim this, I am signing this object:

@akkyie
akkyie / slack-invite-everyone-into-a-channel.sh
Last active July 28, 2017 10:00
Invite everyone into a channel
http https://slack.com/api/users.list token==$SLACK_TOKEN | jq ".members[].id" | xargs -I{} http https://slack.com/api/channels.invite token==$SLACK_TOKEN channel==$SLACK_CHANNEL user=={}
import UIKit
public protocol Reusable: class {
static var reuseIdentifier: String { get }
}
extension UITableViewCell: Reusable {
public static var reuseIdentifier: String {
return NSStringFromClass(self)
}
for FRAMEWORK in `\find Carthage/Build/iOS/ -name "*.framework"`; do
PLIST=$FRAMEWORK/Info.plist
grep "<string>com.firebase.Firebase</string>" $PLIST >/dev/null
if [ $? = 0 ]; then
NAME=$(basename $FRAMEWORK .framework)
echo "Replacing bundle identifier of $NAME"
plutil -replace CFBundleIdentifier -string "com.firebase.Firebase.$NAME" $PLIST
fi
done