Skip to content

Instantly share code, notes, and snippets.

View srph's full-sized avatar
🛠️
Building @Stride-Labs Frontend

Kier Borromeo srph

🛠️
Building @Stride-Labs Frontend
View GitHub Profile
@srph
srph / delay.js
Last active May 17, 2018 08:28
Add a delay between each ajax call
export default function delay(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms)
})
}
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
@srph
srph / f.txt
Last active February 13, 2018 11:05
txt
@srph
srph / index.js
Created February 11, 2018 21:10
Node: Scale images to ideal size
const Jimp = require('jimp')
const path = require('path')
const glob = require('./utils/glob')
const optim = 300
async function main() {
const files = await glob(path.resolve(__dirname, 'imgsrc/*'))
files.forEach(async file => {
@srph
srph / index.js
Created January 26, 2018 21:20
React: Declaratively resolve data
import React, {Children, cloneElement} from 'react'
import T from 'prop-types'
/**
* Delay component from mounting until promise is resolved.
*/
class Resolver extends React.Component {
state = {
resolved: false,
data: null
@srph
srph / index.js
Last active January 26, 2018 21:22
React: Compose HOCs on-the-go without variable assignment (https://github.com/srph/react-hoc-compose)
import React, {cloneElement} from 'react'
/**
* Make it easier to apply HOC to a component
* without having to assign it to a variable
*/
class Compose extends React.Component {
applied = this.props.hoc(this.props.component)
render() {
@srph
srph / index.js
Created January 26, 2018 11:19
React: Building permission HOCs
import React from 'react'
import history from '@/history'
import make from './make'
export default {
/**
* Only guests can enter this page
*/
guest: make((props) => {
if (props.auth.data == null) {
@srph
srph / auth.php
Last active January 10, 2018 18:51
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
<?php
class Auth {
/**
* Our unique session key
*/
protected $key = '__MY_APP_AUTH__';
/**
* PDO Instance
<template>
<div :ref="(el) => this.el = el"></div>
</template>
@srph
srph / Root.js
Created December 30, 2017 13:03
<template>
<autocomplete>
<input slot-scope="props" ref="props.inputRef" @change="props.change" :value="props.value"></input>
</autocomplete>
</template>