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 Doctrine\ORM\EntityRepository; | |
class Wantlet_Validate_EmailAvailable extends Zend_Validate_Abstract { | |
const NOT_AVAILABLE = 'notAvailable'; | |
protected $_messageTemplates = array( | |
self::NOT_AVAILABLE => "Email address '%value%' is already in 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
ifdef SUDO_USER | |
USER=$(SUDO_USER) | |
endif | |
INSTALL=apt-get install -y | |
INSTALL_LIB=$(INSTALL) lib$(1)-dev | |
REMOVE = \ | |
apt-get purge -y $(1)*; \ |
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
let relayStore; | |
function relayCreateStore() { | |
const env = new Relay.Environment(); | |
env.injectNetworkLayer(new Relay.DefaultNetworkLayer('/graphql')); | |
if (__DEV__) { | |
RelayNetworkDebug.init(env); | |
} | |
env.reset = () => relayCreateStore(); | |
env.mutate = ({ | |
query, |
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
// Turns out this function already exists in Sass: mix(fg, bg, %) (http://d.pr/mGqa) | |
// Alpha blending | |
@function blend($bg, $fg) { | |
$r: red($fg) * alpha($fg) + red($bg) * (1 - alpha($fg)); | |
$g: green($fg) * alpha($fg) + green($bg) * (1 - alpha($fg)); | |
$b: blue($fg) * alpha($fg) + blue($bg) * (1 - alpha($fg)); |
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 | |
// composer require ramsey/uuid moontoast/math | |
require_once 'vendor/autoload.php'; | |
use Ramsey\Uuid\Codec\OrderedTimeCodec; | |
use Ramsey\Uuid\Codec\TimestampFirstCombCodec; | |
use Ramsey\Uuid\Generator\CombGenerator; | |
use Ramsey\Uuid\UuidFactory; |
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
adb shell input keyevent 82 && adb shell input keyevent 19 && adb shell input keyevent 23 |
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
// @flow | |
import { ConnectionHandler } from 'relay-runtime'; | |
import { isObject, isArray } from 'lodash/fp'; | |
export function listRecordRemoveUpdater({ parentId, itemId, parentFieldName, store }) { | |
const parentProxy = store.get(parentId); | |
const items = parentProxy.getLinkedRecords(parentFieldName); | |
parentProxy.setLinkedRecords(items.filter(record => record._dataID !== itemId), parentFieldName); | |
} |
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
export const safeGoBack = ( | |
history: History, | |
alternativeRoute: string, | |
) => { | |
if (history.length > 2) { | |
history.goBack(); | |
return; | |
} | |
history.push(alternativeRoute); |
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 adb_connect { | |
# PORT used to connect. Default: 5555 | |
PORT=${1:-5555} | |
# IP address from current device connected | |
IP_ADDRESS=`adb shell ip route | awk '{print $9}'` | |
echo "ADB connect to $IP_ADDRESS on port $PORT" | |
# Change connection from usb to tcpip using $PORT |
OlderNewer