Skip to content

Instantly share code, notes, and snippets.

@ziiw
ziiw / gradient-animation.css
Last active June 14, 2023 15:56
Gradient animation in CSS
button {
background-image: linear-gradient(
to right,
rgba(236, 0, 140, 1),
rgba(231, 165, 65, 1)
);
background-size: 180% 100%;
background-position: 0px 0px;
transition: all 0.25s linear;
}
@ziiw
ziiw / jsconfig.json
Last active June 12, 2023 14:25
Example of absolute import for React - ViteJS - Typescript - Vanilla
// Needed for VSCode
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"src/*": ["./src/*"],
}
}
}
@ziiw
ziiw / index.js
Created January 23, 2023 13:59
Simple drag n drop of a element in vanilla JS
const wrapper = document.createElement("div");
document.body.appendChild(wrapper);
wrapper.style.position = "absolute";
wrapper.style.backgroundColor = "red";
wrapper.style.width = "100px";
wrapper.style.height = "100px";
let isClicked = false;
let offsets = {x: 0, y: 0}
import React from 'react'
import d3 from 'd3'
class Line extends React.Component {
static propTypes = {...}
drawLine() {
let xScale = d3.scaleTime()
.domain(d3.extent(this.props.data, ({date}) => date));
.shadows {
&.dp-1 {
box-shadow: 0px 0px 2px 0px rgba(0,0,0,0.14), 0px 2px 2px 0px rgba(0,0,0,0.12), 0px 1px 3px 0px rgba(0, 0, 0, 0.2);
}
&.dp-2 {
box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.14), 0px 3px 4px 0px rgba(0,0,0,0.12), 0px 1px 5px 0px rgba(0, 0, 0, 0.2);
}
@ziiw
ziiw / ViewController.swift
Last active November 14, 2016 17:47
Hide status bar at event iOS > 9
class ViewController: UIViewController {
var isHidden:Bool = false
@IBAction func clicked(sender: AnyObject) {
isHidden = !isHidden
UIView.animateWithDuration(0.5) { () -> Void in
self.setNeedsStatusBarAppearanceUpdate()
}
}
override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation {
return UIStatusBarAnimation.Slide
@ziiw
ziiw / rotate.js
Created November 9, 2016 11:59
Detect rotation angle with Tween
TweenMax.to(elem, duration, {
rotationY: rotationY,
ease: Power4.easeOut,
onUpdateParams:["{self}"],
onUpdate: (tween) => {
let st = window.getComputedStyle(circle, null)
let tr = st.getPropertyValue("-webkit-transform") ||
st.getPropertyValue("-moz-transform") ||
st.getPropertyValue("-ms-transform") ||
st.getPropertyValue("-o-transform") ||
@ziiw
ziiw / ios-version.js
Created November 9, 2016 11:28 — forked from Craga89/ios-version.js
JavaScript iOS version detection
/*
* Outputs a float representing the iOS version if user is using an iOS browser i.e. iPhone, iPad
* Possible values include:
* 3 - v3.0
* 4.0 - v4.0
* 4.14 - v4.1.4
* false - Not iOS
*/
var iOS = parseFloat(

Keybase proof

I hereby claim:

  • I am ziiw on github.
  • I am adrienlav (https://keybase.io/adrienlav) on keybase.
  • I have a public key ASCi-864eFzMNoAh3RTuyamMBfeBPojYq700hKqzhY1twwo

To claim this, I am signing this object: