Skip to content

Instantly share code, notes, and snippets.

View danywalls's full-sized avatar
👋
Hello!

Dany Paredes danywalls

👋
Hello!
View GitHub Profile
@danywalls
danywalls / Players.js
Last active April 24, 2024 21:58
Set the default value in react-select component
import React, {Component} from 'react';
import Select from 'react-select';
class Players extends Component {
state = {
defaultSelected: 2,
playerOptions: [
{ value: 1, label: 'Lebron'},
{ value: 2, label: 'Davis'}
]
@danywalls
danywalls / loader.js
Created December 24, 2018 07:49
Load content async with jquery
$(document).ready(function(){
//global function to able load all content by ajax.
$('a').bind('click', function(e) {
var url = $(this).attr('href');
$('div#container').load(url);
e.preventDefault();
});
})
@danywalls
danywalls / app.js
Last active February 12, 2022 16:47
ES6 Basic Examples
let name = 'John';
let test;
name = 'Jack';
const person = {
name: 'Jhon',
age: 33
};
console.log(person.name);
@danywalls
danywalls / password.pipe.ts
Last active December 7, 2022 13:10
Angular Pipe for Password.
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'password'
})
export class PasswordPipe implements PipeTransform {
transform(value: string, hide: boolean = true): any {
return !hide ? value.replace(/./g, '*') : value;
@danywalls
danywalls / EdgarJs
Last active December 24, 2018 08:47
Helper to manage the local and session storage.
var EdgarJs = {
Session: {
load(key, value) {
if (localStorage.getItem(key)) {
return localStorage.getItem(key);
}
return "not existe";
@danywalls
danywalls / CheckEmptyFields.js
Created January 20, 2015 16:48
CheckEmptyFields
function CheckEmptyFields()
{
$(".required").each(function()
{
if($.trim($(this).val()).length == 0)
{
$(this).addClass("warning");
}
else
{
@danywalls
danywalls / radiowithtextrigthside
Created January 20, 2015 16:46
radio with text rigth side
input[type="radio"]
{
vertical-align:top;
}