Skip to content

Instantly share code, notes, and snippets.

View dhrrgn's full-sized avatar
🦙

Dan Horrigan dhrrgn

🦙
  • OH, USA
  • 22:24 (UTC -04:00)
View GitHub Profile
@dhrrgn
dhrrgn / index.html
Created August 20, 2022 14:45
Llamaly Landing
<div><img src="https://llamaly-assets.s3.us-east-2.amazonaws.com/images/logo-large.jpg" /></div>
<?php
$user = User::whereToken($token)->first();
if (!$user) {
return ['message' => 'Sorry, no user found with that token.'];
}
return $user;
onMoveShouldSetPanResponder: (e, g) => {
if (g.dx === 0 || g.dy === 0) return false;
return true;
},
// Or if you like 1 liners:
onMoveShouldSetPanResponder: (e, g) => !(g.dx === 0 || g.dy === 0),
static boot
static bootTraits
static clearBootedModels
static addGlobalScope
static hasGlobalScope
static getGlobalScope
static observe
static hydrate
static hydrateRaw
static create
// Bind in constructor
class BindInConstructor {
constructor() {
this.foo = this.foo.bind(this);
this.bar = this.bar.bind(this);
}
foo() {
this.bar();
}
@dhrrgn
dhrrgn / read_logs.sh
Last active October 28, 2016 19:10
Quick script to grab one or more log files (even gzipped ones) from multiple hosts at once.
#!/usr/bin/env bash
hosts=(
# list the hosts to grab the logs from
host1.foo.com
host2.foo.com
)
remote_files=(
# list the log files to grab
<?php
public function __call($method, $args) {
if (! $this->isConnected() || ! method_exists($this->pdo, $method)) {
throw new \BadMethodCallException("Method '$method' not found on ExtendedPdo");
}
return call_user_func_array([$this->pdo, $method], $args);
}
var imageUrls = [/* image urls here */];
// The basic prefetch and forget.
imageUrls.map((url) => Image.prefetch(url));
// ------------- OR -------------
// Prefetch and replace image urls that fail to load with a default image URL
// Note: You could/should bundle the default image with the app so it doesn't
// need prefetched, and would load instantly.
import { combineReducers } from 'redux';
/**
* Combine a set of ReduxModel reducers.
*
* @param array {models} An array of ReduxModel objects.
* @return function A combined redux reducer
*/
export function combineModelReducers(models) {
let reducers = {};
import React, {
Component,
PropTypes,
} from 'react';
import {
ScrollView as RNScrollView,
View,
} from 'react-native';