Skip to content

Instantly share code, notes, and snippets.

@oceanapplications
oceanapplications / gist:44d69d83971d3248b60a
Created June 29, 2015 04:02
String case inversion script
//Version 1, simple and performs about 40 times better than version 2
$input = "i FORGOT CAPLOCK";
$output = "";
foreach(str_split($input) as $letter)
{
if(ctype_upper($letter))
{ $output .= strtolower($letter);}
else { $output .= strtoupper($letter); }
}
echo $output;
0x8fE7eE0A9127e1B3cf1A0a43851217C87F0BD417
it("should read ethereum price through oraclize", function(){
return Contract.deployed().then(function(instance){
return instance;
}).then(function(instance){
instance.updatePrice({value:20000});
});
});
it("should wait 1 minute and read returned value", function(){
setTimeout(function(){
@oceanapplications
oceanapplications / SerpTest.php
Created May 18, 2018 02:49
Search engine ranking position tracker build on Laravel Dusk
<?php
namespace Tests\Browser;
use function foo\func;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class SerpTest extends DuskTestCase
@oceanapplications
oceanapplications / .deps...npm...@openzeppelin...contracts...token...ERC20...ERC20.sol
Created April 29, 2021 00:54
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.1+commit.df193b15.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
@oceanapplications
oceanapplications / Dockerfile
Last active July 20, 2021 00:43
Building a basic container
FROM nginx:1.21.0
RUN rm -rf /etc/nginx/conf.d/default.conf
ADD index.html /var/www/html/index.html
ADD nginx.conf /etc/nginx/conf.d/nginx.conf
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-basic
labels:
tier: backend
spec:
replicas: 1
selector:
matchLabels:
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
tier: backend
spec:
selector:
app: nginx
tier: backend
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
ARG PHP_EXTENSIONS="apcu bcmath pdo_mysql redis imagick gd"
FROM thecodingmachine/php:8.0-v4-fpm as php_base
ENV TEMPLATE_PHP_INI=production
#copy our laravel application to html
COPY --chown=docker:docker . /var/www/html
RUN composer install --quiet --optimize-autoloader --no-dev
FROM node:14 as node_dependencies
WORKDIR /var/www/html
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=false
#bring in the laravel application from the php_base to our node js container