Skip to content

Instantly share code, notes, and snippets.

View jjjjcccjjf's full-sized avatar
🎯
Focusing

endan jjjjcccjjf

🎯
Focusing
View GitHub Profile
<?php
#class declaration
class Firebase_model extends CI_model
{
public function __construct()
{
parent::__construct();
define('FIREBASE_API_KEY', 'AAAAh66AGWk:APA91bE83vgJIkt-Edb9iStKIWErZ0iE2UvQR8hXM_iQOzNwZu25C1IChOn8GmxyWg5yzMuCpFa55UhMvoqRLzS0hPZt4jUtQUjMq6IHbMMHMVM3IbguGLgQCqKmneqKIG1c9SWi7khL1g7GkOLiase7xPtvJ_WKIw');
}

Restigniter

How to sanitize inputs

$this->input->post('key', true); # for single key post variable
$this->input->post(null, true) # for the whole post object

How to escape json properly

@jjjjcccjjf
jjjjcccjjf / mysql emoji guide.md
Last active September 14, 2018 08:23
Working with Emojis [MySQL GUIDE]

How to enable emojis in MySQL database

TLDR:

If you are using CodeIgniter

  • Set the character set into utf8mb4 and DB collation to utf8mb4_bin
  • Or you can just edit application/config/database.php like this
// Put in head
// For adding class based on window hash
$(window).on('hashchange', function() {
let hash = window.location.hash;
$('a').removeClass('active');
$('a[href=\"' + hash + '\"]').addClass('active');
});
// ... in the body
@jjjjcccjjf
jjjjcccjjf / ajax sample.md
Last active March 7, 2018 03:22
Ajax sample code
// GET JSON BLOCK

$.getJSON('http://localhost/api/members', function(result){ 

});
// GET JSON BLOCK

So, you want to add a new estate, huh?

Add your estate here

/dashboard/application/models/Analytics_model.php

'filters' => "ga:pagePathLevel1==altaraza.ph/,ga:pagePathLevel1==arcasouth.ph/,ga:pagePathLevel1==bgc.ayalalandestates.com/,ga:pagePathLevel1==circuitmakati.com/,ga:pagePathLevel1==cloverleaf.ph/,ga:pagePathLevel1==evocity.com.ph/,ga:pagePathLevel1==makeitmakati.com/,ga:pagePathLevel1==nuvali.ph/,ga:pagePathLevel1==vermosa.ph/,ga:pagePathLevel1==vertis.ph/,ga:pagePathLevel1==www.alviera.ph/",

Don't forget to add your GA ID in this array

			$AYL_GA_ARR = [
@jjjjcccjjf
jjjjcccjjf / captcha_example.php
Last active February 5, 2018 01:48
Google ReCAPTCHA example
# Get your API key here
https://www.google.com/recaptcha/admin#list
# This is the main captcha url
# Put on your <head> tag
# Omit this if you're using the code block below
<script src="https://www.google.com/recaptcha/api.js"></script>
# This is a script for multiple captchas on the same page
# Put on <head> tag
<?php
/* Template Name: Inquire now */
get_header();
# Block for brand & project name
$page_id = 884; # Page ID: Welcome - Ayala Group Employee
if(isset($_SESSION['employer_type']) && $_SESSION['employer_type'] == "Corporate partners")
{
$page_id = 885; # Page ID: Welcome - Corporate partners
}
(array) [16 elements]
0:
(array) [12 elements]
blog_id: (string) 1
domain: (string) ayalalandestates.com
path: (string) /
site_id: (string) 1
registered: (string) 2017-11-14 05:35:36
last_updated: (string) 2017-11-23 09:48:18
public: (string) 1
@jjjjcccjjf
jjjjcccjjf / remove_slug.php
Created November 22, 2017 10:53
Put in functions.php wordpress
/** remove slugggg */
function na_remove_slug( $post_link, $post, $leavename ) {
if ( 'venue_cpt' != $post->post_type || 'publish' != $post->post_status ) {
return $post_link;
}
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
return $post_link;