Skip to content

Instantly share code, notes, and snippets.

View ruucm's full-sized avatar
🎾
Focusing

ruucm

🎾
Focusing
View GitHub Profile
@ruucm
ruucm / gist:fc8dae787fba410b0c88fed7d2265efb
Created November 2, 2018 16:57
WordPress functions.php Cheat Sheet
/**
* Unset Woocommerce Shipping Address fields
*/
add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' );
function custom_remove_woo_checkout_fields( $fields ) {
// remove billing fields
// unset($fields['billing']['billing_country']);
@ruucm
ruucm / funtions.php
Created November 2, 2018 17:00
WordPress functions.php Cheat Sheet
/**
* Unset Woocommerce Shipping Address fields
*/
add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' );
function custom_remove_woo_checkout_fields( $fields ) {
// remove billing fields
// unset($fields['billing']['billing_country']);
@ruucm
ruucm / dasf
Created November 2, 2018 17:02
sdafsadf
what happens on gist!!
it crashed...
@ruucm
ruucm / remove_new_term.php
Created December 21, 2018 06:34
remove specific term from all posts (wordpress)
<?php
$args = array(
'post_type' => 'cartoon',
'tax_query' => array(
array(
'taxonomy' => 'new_or_popular',
'field' => 'term_id',
'terms' => 110,
)
@ruucm
ruucm / add_new_term.php
Created December 21, 2018 06:49
add specific term to last 2 month posts (wordpress)
<?php
$args = array(
'post_type' => 'cartoon',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
// Using the date_query to filter posts from last 2 month
@ruucm
ruucm / useMotionValueListen.js
Created May 11, 2019 18:47
Custom hook to listen MotionValue change of Framer X
import { useMemo } from 'react'
import { MotionValue } from 'framer'
var __assign = function() {
__assign =
Object.assign ||
function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i]
for (var p in s)
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory((function webpackLoadOptionalExternalModule() { try { return require("framer"); } catch(e) {} }()), (function webpackLoadOptionalExternalModule() { try { return require("framer-package-loader!@framer/harborschool.colors"); } catch(e) {} }()), (function webpackLoadOptionalExternalModule() { try { return require("framer-package-loader!@framer/harborschool.text"); } catch(e) {} }()), (function webpackLoadOptionalExternalModule() { try { return require("framer-package-loader!@framer/harborschool.utils"); } catch(e) {} }()));
else if(typeof define === 'function' && define.amd)
define(["framer", "framer-package-loader!@framer/harborschool.colors", "framer-package-loader!@framer/harborschool.text", "framer-package-loader!@framer/harborschool.utils"], factory);
else {
var a = typeof exports === 'object' ? factory((function webpackLoadOptionalExternalModule() { try
@ruucm
ruucm / vid-to-gif.sh
Last active September 18, 2019 21:52
A simple bash script changing Video file to GIF using ffmpeg. It keeps aspect ratio of the video
#!/bin/bash
read -p "Input Video: " vid
read -p "Known Dimension(VID_WIDTH): " VID_WIDTH
read -p "Known Dimension(VID_HEIGHT): " VID_HEIGHT
# trim file name
x=${vid##*/}
y=${x%.*}
filename=${y##*/}
# keeps aspect ratio
@ruucm
ruucm / useGiphy.js
Created December 15, 2019 12:09
A simple react hook to get Giphy random image (install use-http hook first)
import { useRef, useState, useEffect } from "react";
import useFetch from "use-http";
const useGiphy = search => {
const [loading, setLoading] = useState(false);
const [data, setData] = useState([]);
const [request, response] = useFetch("http://api.giphy.com/v1");
useEffect(() => {
const getUrl = async () => {
@ruucm
ruucm / useUnsplash.js
Last active December 15, 2019 12:09
A simple react hook to get unsplash radom image without API
import { useRef, useState, useEffect } from "react";
const useUnsplash = search => {
const [loading, setLoading] = useState(false);
const [data, setData] = useState([]);
useEffect(() => {
const getUrl = async () => {
var currentSize = 800;
const baseUrl = "https://source.unsplash.com";
const route = search === "" ? "/random" : `/featured`;