Skip to content

Instantly share code, notes, and snippets.

View darthzyklus's full-sized avatar

Andrés darthzyklus

View GitHub Profile
@darthzyklus
darthzyklus / audit-on-push.yml
Created January 20, 2023 10:58 — forked from LukeMathWalker/audit.yml
GitHub Actions - Rust setup
name: Security audit
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
runs-on: ubuntu-latest
steps:
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// [MIT License]
/// @title Base64
@darthzyklus
darthzyklus / .php_cs.laravel.php
Created December 5, 2020 21:59 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null]
@darthzyklus
darthzyklus / approach-examples.js
Created July 31, 2019 18:41
approach-examples
//---------------
// First approach
//---------------
class Controller extends Component {
//..methods and props
render(
return <Presentation {...API} />
)
@darthzyklus
darthzyklus / deploy.php
Created April 18, 2019 00:57
Deploy example
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Project name
set('application', 'trackandraces');
// Project repository
set('repository', 'git@github.com:darthzyklus/trackandraces.git');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
// Shared files/dirs between deploys
const areYouPlayingBanjo = (name) => (
`${name} ${( (/^r/i).test(name) ? "plays" : "does not play" )} banjo`
);
const isValidWalk = walk => (
walk.length == 10
&& walk.filter(step => step == 'n').length == walk.filter(step => step == 's').length
&& walk.filter(step => step == 'w').length == walk.filter(step => step == 'e').length
);
function solution(input, markers) {
const comments = new RegExp(`[${markers.join("")}].+`, "g");
const whiteSpaceAtTheEnd = /(\s+(?=\n))|(\s+$)/g;
return input.replace(comments, "").replace(whiteSpaceAtTheEnd, "");
};
@darthzyklus
darthzyklus / closestElevator.js
Created March 2, 2019 17:24
get the closest elevator
function elevator(left, right, call){
if (left == right) return "right";
var leftDistance = Math.abs(call - left);
var rightDistance = Math.abs(call - right);
return leftDistance < rightDistance ? "left":"right";
}
@darthzyklus
darthzyklus / all_inclusive.js
Last active March 1, 2019 13:25
Solution to all inclusive kata.
function containAllRots(strng, arr) {
var letters = strng.split("");
for (var i = 0; i < strng.length; i++) {
if ( !arr.includes(letters.join("")) ) return false;
letters.unshift(letters.pop());
}