Skip to content

Instantly share code, notes, and snippets.

View webdevid's full-sized avatar
🎯
Focusing

dodi hidayatullah webdevid

🎯
Focusing
View GitHub Profile
/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs
<?php
/**
* Plugin Name: Underscores.me Generator
* Description: Generates themes based on the _s theme.
*/
class Underscores_Generator_Plugin {
protected $theme;
@webdevid
webdevid / gulpfile.js
Last active August 19, 2017 14:24 — forked from zellwk/gulpfile.js
Gulpfile development-phase
var gulp = require('gulp');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var notify = require('gulp-notify');
var browserSync = require('browser-sync');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var spritesmith = require('gulp.spritesmith');
var gulpIf = require('gulp-if');
var nunjucksRender = require('gulp-nunjucks-render');
@webdevid
webdevid / gulpfile.js
Created August 20, 2017 03:34 — forked from zellwk/gulpfile.js
Gulpfile-testing-phase
var gulp = require('gulp');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var notify = require('gulp-notify');
var browserSync = require('browser-sync');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var spritesmith = require('gulp.spritesmith');
var gulpIf = require('gulp-if');
var nunjucksRender = require('gulp-nunjucks-render');
@webdevid
webdevid / Learning React Redux ES6 resources.md
Created October 26, 2017 00:08 — forked from tirams/Learning React Redux ES6 resources.md
Here are some resources I’ve used to learn react, redux and es6
@webdevid
webdevid / functions.php
Created November 8, 2017 04:38 — forked from WebEndevSnippets/functions.php
WordPress: Reduce Database Queries
Reduce database queries (http://www.catswhocode.com/blog/speeding-up-your-wordpress-blog-7-effective-solutions)
It is important to reduce unecessary queries to your database as each query take a few milliseconds to execute. First, you might want to know how many queries your blog execute in order to display a page. To do so, paste the code below in your functions.php file. Once done, just have a look to your site footer to know how many queries has been executed and how many time it took to completely load the page.
add_action( 'wp_footer', 'tcb_note_server_side_page_speed' );
function tcb_note_server_side_page_speed() {
date_default_timezone_set( get_option( 'timezone_string' ) );
$content = '[ ' . date( 'Y-m-d H:i:s T' ) . ' ] ';
$content .= 'Page created in ';
$content .= timer_stop( $display = 0, $precision = 2 );
$content .= ' seconds from ';
@webdevid
webdevid / config.php
Created June 8, 2018 02:55 — forked from sapegin/config.php
Microstock FTP Uploader
<?php
$stocks = array (
'shutterstock' => array (
'name' => 'Shutterstock',
'host' => 'ftp.shutterstock.com',
'login' => '',
'password' => '',
'dir' => '/',
@webdevid
webdevid / spintax.php
Created August 8, 2018 12:30 — forked from irazasyed/spintax.php
PHP: Text Spinner Class - Nested spinning supported.
<?PHP
/**
* Spintax - A helper class to process Spintax strings.
* @name Spintax
* @author Jason Davis - https://www.codedevelopr.com/
* Tutorial: https://www.codedevelopr.com/articles/php-spintax-class/
*/
class Spintax
{
public function process($text)
@webdevid
webdevid / simple_php_pagination.php
Created September 7, 2018 04:22 — forked from Stichoza/simple_php_pagination.php
Simple PHP Pagination (one function)
<?php
/**
*
* Simple PHP Pagination
*
* @author Stichoza
* @link http://stichoza.com/
* @email admin@stichoza.com
* @version 1.0
@webdevid
webdevid / ContactForm.md
Created October 27, 2018 12:36 — forked from patotoma/ContactForm.md
secure php contact form

Secured PHP Contact Form

<?php
  if(isset($_POST['submit'])){
    $name = htmlspecialchars(stripslashes(trim($_POST['name'])));
    $subject = htmlspecialchars(stripslashes(trim($_POST['subject'])));
    $email = htmlspecialchars(stripslashes(trim($_POST['email'])));
    $message = htmlspecialchars(stripslashes(trim($_POST['message'])));
    if(!preg_match("/^[A-Za-z .'-]+$/", $name)){