Skip to content

Instantly share code, notes, and snippets.

View 2n2n's full-sized avatar

Anthony Yolach Lloveras 2n2n

  • Innoendo I.T. Soutions
  • General Santo City
View GitHub Profile
import React, { useEffect, useRef, useState, useCallback, useMemo } from 'react';
export default () => {
const inputRef = useRef();
const [percentage, setPercentage] = useState(0);
const [start, setStart] = useState(false);
let intervalRef = useRef();
useEffect(() => { console.log(percentage) }, [percentage])
useEffect(() => {
{
"programs": [
{
"id": 1,
"lesson_name": "lesson 1",
"lessons": [
{
"id": 1,
"title": "Regular Lesson",
"price": 15.00,
@2n2n
2n2n / App.js
Created February 25, 2020 06:05
Drag and drop sample using wix/react-native-calendars and simpleDnD library.
/**
* Wix/react-native-calendars with drag and drop
* created by: anthony lloveras
* email: anthonylloveras.boxtypd@gmail.com
*/
import React, { useState } from 'react';
import faker from 'faker';
import { Calendar } from 'react-native-calendars';
import {
@2n2n
2n2n / App.js
Created February 25, 2020 06:05
Drag and drop sample using wix/react-native-calendars and simpleDnD library.
/**
* Wix/react-native-calendars with drag and drop
* created by: anthony lloveras
* email: anthonylloveras.boxtypd@gmail.com
*/
import React, { useState } from 'react';
import faker from 'faker';
import { Calendar } from 'react-native-calendars';
import {
@2n2n
2n2n / app.js
Created January 21, 2020 10:32
Manipulate external svg via javascript
var svgs = document.getElementsByClassName('mysvg')
function svgBold(elems) {
var boldSize = 10;
for (var i in Object.keys(elems)) {
var el = elems[i].contentDocument;
var number = el.getElementsByClassName('st0')[0];
var circle = el.getElementsByClassName('st1')[0];
number.style.strokeWidth = boldSize;
@2n2n
2n2n / main.py
Created May 26, 2019 02:29
python3 flask-restful issue
from flask import Flask
from flask_restful import Resource, Api
from flask_cors import CORS
app = Flask(__name__)
api = Api(app)
CORS(app)
def get(self):
args = request.args
try:
// imports..
@Component({
// same same ...
})
export class MyComponent implements OnInit {
public form: FormGroup;
constructor(private config: MyService) {}
ngOnInit() {
@2n2n
2n2n / sidebar-menu-accrodion.directive.ts
Last active August 5, 2017 03:19
Animation problems with angular 4
import { Directive, HostListener, ElementRef } from '@angular/core';
function hideTreeview(elements, type?: string) {
if(elements.length < 1 || elements === undefined) { return; }
for(let i = 0; i < elements.length; i++) {
if(type === "subtree") {
elements[i].style.display = 'none';
return;
}
@2n2n
2n2n / header.component.html
Created August 4, 2017 14:11
Accessing the body tag of the angular app and toggling the class using angular 4 attribute directives
// since the <body> tag is inside the index.php and doesn't have any component.ts
<a alphaToggleNav class="sidebar-toggle" data-toggle="offcanvas" role="button">
// the alphaToggleNav directive will find the body tag, and will change the className depending on the state.