Skip to content

Instantly share code, notes, and snippets.

View ilyador's full-sized avatar

Ilya Dorman ilyador

View GitHub Profile
@ilyador
ilyador / nextjs-tweets.js
Created October 19, 2022 21:56
nextjs-tweets
import react from 'react'
import needle from 'needle'
const token = process.env.BEARER_TOKEN
const recentEndpointUrl = "https://api.twitter.com/2/tweets/search/recent";
function Page ({ data }) {
console.log(data)
@ilyador
ilyador / app.jsx
Last active February 20, 2020 19:58
auth with router
function App () {
const [user, setUser] = useState(null)
const [authenticating, setAuthenticating] = useState(true)
useEffect(() => {
Auth.currentAuthenticatedUser()
.then(data => { setUser(data.attributes) })
.catch(error => { console.log(error) })
.finally(() => { setAuthenticating(false) })
}, [])
@ilyador
ilyador / image.js
Last active September 3, 2019 16:38
Rotating a picture and uploading it as a file with blueimp-load-image . Image to canvas to blob to file to s3.
import React, { useState } from 'react'
import uuid from 'uuid/v4'
import loadImage from 'blueimp-load-image'
const handleChange = event => { // on file input change
let _file = event.target.files[0]
if (!_file) return
let _fileExt = _file.name.split('.').pop()
let _fileName = uuid() + '.' + _fileExt
@ilyador
ilyador / SassMeister-input.scss
Created November 22, 2015 13:58
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
.ad-param,
.ad-current-test {
.legend-symbol {
color: red;
}
}
@ilyador
ilyador / tooltip.css
Last active August 29, 2015 14:23
CSS-only animated tooltips
/* Originally by Chris Bracco with a few cleanups and fixes http://cbracco.me/a-simple-css-tooltip/ */
/* Base styles for the element that has a tooltip */
[tooltip],
.tooltip {
position: relative;
cursor: pointer;
}
/* Base styles for the entire tooltip */
@ilyador
ilyador / dabblet.css
Last active September 2, 2015 16:04
HTML & CSS mini-course
/* HTML & CSS mini-course
- Box model
- position
- floats
- shorthands
- box sizing
- z-index
- flex (later)
@ilyador
ilyador / client.js
Created September 7, 2014 10:38
Custom login method with Meteor
function loginCallback (error, result) {
console.log(error, result);
}
Meteor.loginWithCode = function(phone, code) {
Accounts.callLoginMethod({
methodArguments: [{
hascode: true,
phone: phone,