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
import { createElement, useEffect, useRef } from 'react' | |
const RightClick = ({ as = 'div', onRightClick, children, ...rest }) => { | |
const ref = useRef() | |
useEffect(() => { | |
const handler = e => { | |
e.stopPropagation() | |
e.preventDefault() | |
onRightClick(e) |
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
# Install NVM or FVM | |
# https://github.com/nvm-sh/nvm | |
# https://github.com/Schniz/fnm | |
cd () { builtin cd "$@" && chpwd; } | |
chpwd () { | |
NVM_PATH="$PWD/.nvmrc" | |
if test -f "$NVM_PATH"; then | |
nvm use |
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
const CANVAS_WIDTH = 1000; | |
const CANVAS_HEIGHT = 800; | |
function resizeImage(imageWidth, imageHeight) { | |
const ratio = imageWidth / imageHeight; | |
let width = CANVAS_WIDTH; | |
let height = width / ratio; | |
if (height > CANVAS_HEIGHT) { | |
height = CANVAS_HEIGHT; |
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
import { Map, List } from 'immutable'; | |
const diff = require('immutablediff'); | |
const patch = require('immutablepatch'); | |
export const ActionTypes = { | |
UNDO: 'undoable/UNDO', | |
REDO: 'undoable/REDO', | |
LOAD: 'undoable/LOAD', | |
CLEAR_PAST: 'undoable/CLEAR_PAST', | |
}; |
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
@mixin font-resposive($font-from, $font-to, $media-from, $media-to) { | |
@media screen and (max-width: $media-from) { | |
font-size: $font-from + 0px; | |
&:before { content: $font-from + ''; } | |
} | |
$iteration-count: $font-to - $font-from; | |
$divider: ($media-to - $media-from) / $iteration-count; | |
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
document.addEventListener('touchmove', handleTouchMove, false) | |
document.addEventListener('touchend', handleTouchEnd, false) | |
class Position { | |
constructor(x, y) { | |
this.x = x | |
this.y = y | |
} |
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
// Solution for: | |
// Simple Array Sum | |
// A Very Big Sum | |
function main() { | |
var n = parseInt(readLine()); | |
arr = readLine().split(' '); | |
console.log(arr.map(Number).slice(0, n).reduce( (a, b) => a + b )); | |
} | |
// Staircase |
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 | |
namespace Railhard\ImportBundle\Command; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
abstract class ChainCommand extends Command | |
{ |
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 | |
class DateTimeHelper { | |
/** | |
* @param array $dateintervals Array of \DateInterval | |
* @return \DateInterval | |
*/ | |
public function calculateIntervalAverage($dateintervals) | |
{ |
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 | |
namespace Duedil\Bundle\AppBundle\Command; | |
use Doctrine\ORM\EntityManager; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
abstract class PersistALotOfEntitiesCommand extends Command |