Skip to content

Instantly share code, notes, and snippets.

View ravinsharma12345's full-sized avatar

Ravin ravinsharma12345

View GitHub Profile
@ravinsharma12345
ravinsharma12345 / customcms
Last active December 21, 2015 08:58
Some guide to creating a custom cms
/front-end(publicly visible area)
/admin area(management area)
non-cms, client request url from web server, web server sees if requested file exists, and if it does, it returns it. Very simple. Url is tied closely to the web page
THE FRONT-END AREA
cms(database backend cms, non-database backend cms). url does not exactly correspond directly to files on a server. Instead of creating webpages as files, it is better to use a "controller" to read from a database, based on what the URL was. There is a popular programming pattern called MVC, which is very similar in principle to what a CMS of this type does.
THE ADMIN AREA
@ravinsharma12345
ravinsharma12345 / solid
Created August 24, 2013 09:35
Agile Principles: SOLID (Incomplete)
Cohesion
--------
class ANOTCohesionClass {
private $firstNumber;
private $secondNumber;
private $length;
private $width;
function __construct($firstNumber, $secondNumber){
$this->firstNumber = $firstNumber;
@ravinsharma12345
ravinsharma12345 / readme
Created October 6, 2013 11:12
PROCESS, THREAD, CONCURRENCY, PARALLELISM , IPC, AND SHIT (Essay to Review Back My Memory)
PROCESS, THREAD, CONCURRENCY, PARALLELISM , IPC, AND SHIT
-----------------------------------------------------------
Below is the illustration of an instance(on the moment) of computer program running, which is called a process.
------------
| computer |
| program |
@ravinsharma12345
ravinsharma12345 / readme
Created October 10, 2013 04:20
Sublime Text 3 ,default scopes for CSS.tmlanguage
CSS
keyword.control.at-rule.charset.css
punctuation.definition.keyword.css
meta.at-rule.charset.css
keyword.control.at-rule.import.css
punctuation.definition.keyword.css
meta.at-rule.import.css
support.function.url.css
punctuation.section.function.css
punctuation.section.function.css
@ravinsharma12345
ravinsharma12345 / helper_dump.php
Created December 3, 2013 08:58
Call Dump helper function to ease debugging in wordpress. Call a temp file output to it, then return it to the front.
<?php
function call_dump($content){
$temp = tmpfile();
fwrite($temp, var_export($content));
fseek($temp, 0);
$content = fread($temp, 1024);
$gettype = gettype($content);
if(ucwords($gettype) === 'ARRAY'){
@ravinsharma12345
ravinsharma12345 / wordpress_get_current_queried_arguments.php
Created December 4, 2013 10:15
Helper function for wordpress to list query argument sent to wordpress of the current query
<?php
add_filter('pre_get_posts', 'wordpress_get_current_queried_arguments');
function wordpress_get_current_queried_arguments($query){
dumper($query, '');
return ;
}// rely on dumper helper functions
<?php
/**
* @package Redirect to homepage after logout
* @version 0.1
*/
/*
Plugin Name: Redirect to homepage after logout
Plugin URI: http://daankortenbach.nl/wordpress/redirect-to-homepage-after-logout/
Description: Redirects the user to the homepage after logout
Author: Daan Kortenbach
/**
* Determine if a post exists based on post_name and post_type
*
* @param $post_name string unique post name
* @param $post_type string post type (defaults to 'post')
*/
function post_exists( $post_name, $post_type='post' ) {
global $wpdb;
<?php
<form name="post" action="post.php" method="post" id="post"<?php do_action('post_edit_form_tag');
<?php
/**
* Callback for WordPress 'post_edit_form_tag' action.
*
* Append enctype - multipart/form-data and encoding - multipart/form-data
* to allow image uploads for post type 'post'
*
* @global type $post
* @return type