Skip to content

Instantly share code, notes, and snippets.

View hosnicolina's full-sized avatar

Hosni Colina hosnicolina

  • Burubasa
  • Venezuela
View GitHub Profile
@hosnicolina
hosnicolina / endpoint.php
Last active October 12, 2023 22:41
hola bebe
<?php
function formated_result_add_order(WP_Post $result, $order)
{
$item = [];
$item['order'] = $order[$result->post_type]["order"];
$item['post_id'] = $result->ID;
$item['title'] = $order[$result->post_type]["title"];
@hosnicolina
hosnicolina / functions.php
Created December 27, 2022 11:34 — forked from mwhiteley16/functions.php
Sort Events by Custom Date Meta Fields
<?php
/**
* Filter Events CPT Using Custom Date Meta Field
* Meta Field in this instance created via Advanced Custom Fields
*
*/
// Sort using pre_get_posts
add_action( 'pre_get_posts', 'wd_event_query_by_date' );
function wd_event_query_by_date( $query ) {
@hosnicolina
hosnicolina / functions.php
Created December 23, 2022 04:19 — forked from tripflex/functions.php
Programmatically create a WooCommerce Subscription and associated WooCommerce Order
<?php
public function give_user_subscription( $product, $user_id, $note = '' ){
// First make sure all required functions and classes exist
if( ! function_exists( 'wc_create_order' ) || ! function_exists( 'wcs_create_subscription' ) || ! class_exists( 'WC_Subscriptions_Product' ) ){
return false;
}
$order = wc_create_order( array( 'customer_id' => $user_id ) );
import { useState, useEffect, useContext } from "react";
import { Form, FormGroup, Alert } from "reactstrap";
import { useFormik } from "formik";
import * as Yup from "yup";
import Link from "next/link";
import Head from "next/head";
import { useRouter } from "next/router";
import LayoutAuth from "@components/layout/LayoutAuth";
import {
<?php
/**
* Template Name: Compartir
*/
$url = get_template_directory_uri() . '/shortlinks.su/';
?>
<!DOCTYPE html>
@hosnicolina
hosnicolina / recomendada.Dockerfile
Created August 27, 2022 17:23 — forked from Klerith/recomendada.Dockerfile
NextJS - Dockerfile - Configuración simple y recomendada
# Fuente: https://github.com/vercel/next.js/blob/canary/examples/with-docker/README.md
# Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
// todo lo que escribas aqui es un comentario
/**
Variables: caja donde se almacena informacion
en javascripts las variables se declaran de 3 formas
var nombre = "hosni"
let nombre = "hosni"
const nombre = "hosni"
@hosnicolina
hosnicolina / scrapy.py
Created August 8, 2018 05:36
scraping de python
from bs4 import BeautifulSoup
import requests
import re
url = 'https://www.xvideos.com/embedframe/38079261'
pattern = r'https://[a-z\-]+\.[a-z\-]+\.[\w\?\_\.\/]+'
r = requests.get(url)
print(r.status_code)