Skip to content

Instantly share code, notes, and snippets.

View guruguruman's full-sized avatar

Tomoyuki Kato guruguruman

  • Tokyo, Japan
View GitHub Profile
@guruguruman
guruguruman / smartproxy.ts
Created June 7, 2024 01:08
Using Smartproxy API in TypeScript
export interface SerpScrapingResult {
query: string;
title: string;
position: number;
url: string;
}
function createRequestParams(apiKey: string, query: string): RequestInit {
return {
method: 'POST',
<style>
.container {
display: flex;
flex-direction: row-reverse;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: stretch;
overflow-x: scroll;
@guruguruman
guruguruman / text-detection.php
Last active January 8, 2019 06:59
Google Cloud Vision API - Text detection
<?php
function fetchImageText($filePath = null, $apiKey = null)
{
if (empty($filePath) || empty($apiKey)) {
return;
}
$json = json_encode(array(
"requests" => array(
@guruguruman
guruguruman / ScrapingProxyProvider.php
Last active January 24, 2021 14:33
Rotate public listed proxies per each request in PHP.
<?php
/**
* A class which provide public listing proxies rotated when client request.
*/
Class ScrapingProxyProvider
{
// Proxies available.
private $proxyDatas = array();
@guruguruman
guruguruman / TravisCI.swift
Last active September 18, 2018 01:43
Determining TravisCI enviroment
class TravisCI {
/*
* check whether test is running on TravisCI or not using TravisCI enviroment variables.
*
* as for TravisCI enviroment variables availables @see https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
*
*/
static var isRunningOnTravisEnviroment: Bool {
let isTravisEnviromentVariableName = "CI"
@guruguruman
guruguruman / Podfile
Last active January 31, 2017 15:56
Forcedly set CocoaPods Build Only Architecture to NO hooking`post_install`
post_install do |installer|
pods_project = installer.pods_project
pods_project.build_configurations.each do |configuration|
pods_project.build_settings(configuration.name)['ONLY_ACTIVE_ARCH'] = 'NO'
end
puts "Forcedly set CocoaPods project `Pods`’s `Build Only Architecture` to `NO`”
end
@guruguruman
guruguruman / onesignal.php
Created September 6, 2016 14:03
Managing to send push notification using OneSignal https://onesignal.com/
<?php namespace App\Services;
use GuzzleHttp\Client;
class OneSignal {
const API_URL_ADD_PLAYER = 'https://onesignal.com/api/v1/players';
const API_URL_CREATE_PUSH = 'https://onesignal.com/api/v1/notifications';
const DEVICE_TYPE_IOS = 0;
const DEVICE_TYPE_ANDROID = 1;
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
@guruguruman
guruguruman / apns-certificate-creator.sh
Last active August 29, 2015 14:02
Create pem file from certificate and keys on Apple Push Notification Service (APNs).sh
################################################################################
#
# Apple Push Notification Certificate Creator v 0.1
#
################################################################################
#After exporting APNs certificates for development as "apns_dev.p12" and the one for production as "apns_pro.p12"
# Development
openssl pkcs12 -clcerts -nokeys -out apns_dev_cert.pem -in apns_dev.p12
@guruguruman
guruguruman / rm-git.sh
Created June 15, 2013 08:33
Remove '.git' from current repository
rm -rf `find ./ -type d -name .git ! -regex \.git/. -print`
#Remove '.gitignore' also.
rm -rf `find ./ -type d -name .gitignore ! -regex \.gitignore/. -print`