This file contains 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
function sprintf(format) { | |
var args = Array.prototype.slice.call(arguments, 1); | |
var i = 0; | |
return format.replace(/%s/g, function() { | |
return args[i++]; | |
}); | |
} |
This file contains 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
function shuffle(array) { | |
var currentIndex = array.length, temporaryValue, randomIndex | |
while (0 !== currentIndex) { | |
randomIndex = Math.floor(Math.random() * currentIndex) | |
currentIndex -= 1 | |
temporaryValue = array[currentIndex] | |
array[currentIndex] = array[randomIndex] | |
array[randomIndex] = temporaryValue | |
} |
This file contains 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
var repos = await (await fetch('https://developersdo.github.io/opensource-data/repos.json')).json() | |
console.log(`Repos Total: ${repos.length}`) | |
var specialRepos = repos.filter(repo => { | |
var [login, name] = repo.name.split('/') | |
return login === name | |
}) | |
console.log(`Special Repos Total: ${specialRepos.length}`) |
This file contains 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
package com.mariuzzo.profiler; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.web.servlet.ModelAndView; | |
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; |
This file contains 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
#!/bin/bash | |
git checkout master | |
git pull origin master | |
git branch | grep -v "master\|develop" | xargs git branch -D |
This file contains 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
// DO NOT COMMIT | |
(() => { | |
const keepAwake = () => { | |
clearTimeout(keepAwake.nod.timeoutId) | |
keepAwake.nod() | |
} | |
keepAwake.nod = () => { | |
keepAwake.nod.timeoutId = setTimeout(() => { | |
location.reload() | |
keepAwake.nod() |
This file contains 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
mkdir x-script | |
cd x-script | |
npm init |
This file contains 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
/** | |
* Keyframes. | |
* Create a named animation sequence that can be applied to elements later. | |
* | |
* Usage: | |
* @include keyframes(fly) { | |
* from { | |
* transform: rotate(0deg); | |
* } | |
* to { |
This file contains 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
#!/bin/sh | |
for file in *.png ; do pngcrush "$file" "${file%.png}-crushed.png" && mv "${file%.png}-crushed.png" "$file" ; done |
This file contains 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 | |
use Carbon\Carbon; | |
use Illuminate\Validation\Validator; | |
class CustomValidator extends Validator { | |
# carbon_date_format # | |
public function validateCarbonDateFormat($attribute, $value, $parameters) |
NewerOlder