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
fetch(url).then(rsp ⇒ rsp.json()) |
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 splitRow(row) { | |
const cols = []; | |
while (row.length) { | |
let commaIdx = row.indexOf(","); | |
const quoteIdx = row.indexOf("\""); | |
if(quoteIdx > -1 && commaIdx > quoteIdx) { | |
commaIdx = row.slice(1).indexOf("\"") + 2; | |
} | |
const stripQuote = (str) => { | |
return str[0] === "\"" && str[str.length - 1] === "\"" ? str.slice(1, str.length - 1) : str |
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 React, { useEffect, useRef } from 'react' | |
import * as PIXI from 'pixi.js' | |
import texture from 'cloud.jpg' | |
export default function RippleImage({ src, style }) { | |
const ref = useRef() | |
useEffect(() => { | |
const app = new PIXI.Application({ | |
width: window.innerWidth, | |
height: window.innerHeight |
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 React, { useEffect, useRef } from 'react' | |
import iro from '@jaames/iro' | |
function ColorPicker({ setColor, color }) { | |
const ref = useRef() | |
const colorPicker = useRef() | |
useEffect(() => { | |
const cp = (colorPicker.current = new iro.ColorPicker(ref.current, { | |
color | |
})) |
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 Parallax from './parallax' | |
import bg1 from './assets/bg1.png' | |
import bg2 from './assets/bg2.png' | |
import bg3 from './assets/bg3.png' | |
function App() { | |
return <Parallax images={[bg1, bg2, bg3]} /> | |
} |
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 React, { useRef, useEffect } from 'react' | |
const MARGIN = 100 | |
const STEP = 0.2 | |
export default function Parallax({ images }) { | |
const refs = useRef({}) | |
const parent = useRef() | |
useEffect(() => { | |
for (const i in refs.current) { |
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
<doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<style> | |
body { | |
margin: none; | |
} | |
.panel { | |
border: 1px solid #ccc; |
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
server { | |
listen 80; | |
listen [::]:80; | |
root /var/www/html; | |
index index.php index.html index.htm index.nginx-debian.html; | |
server_name example.com; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { |
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 { scaleLinear, scaleLog, axisLeft, axisBottom, select, line, format } from 'd3'; | |
const yScale = scaleLog().domain([0, 100]).range([300, 0]) | |
const xScale = scaleLinear().domain([1, 100]).range([0, 500]); | |
const pathline = line().x(d => xScale(d.x)).y(d => yScale(d.y)); | |
axisLeft(yScale).tickValues([maxViews, minViews]).tickFormat(format('.2s'))(select('.leftAxis')); | |
axisBottom(xScale).tickValues([1, songs.length])(select('.bottomAxis')); |
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 | |
if(isset($_GET['productid'])) { | |
$ch = curl_init('http://ebay-api.thedcevents.com/api/findproduct/' . $_GET['productid']); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$output = curl_exec($ch); | |
curl_close($ch); | |
// $result = '{"title":"foo","url":"bar","img":"baz","thumbnails":["asd","qwe"]}'; | |
$result = json_decode($output); | |
if($result->status == 'SUCCESS') { | |
$item = $result->data; |
NewerOlder