Skip to content

Instantly share code, notes, and snippets.

View kenmasters's full-sized avatar

Ken John Siosan kenmasters

View GitHub Profile
@ksafranski
ksafranski / Common-Currency.json
Last active May 14, 2024 12:39
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@studiopress
studiopress / credits-1.php
Last active April 26, 2023 15:09
Genesis footer.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Customize the credits
add_filter( 'genesis_footer_creds_text', 'sp_footer_creds_text' );
function sp_footer_creds_text() {
echo '<div class="creds"><p>';
echo 'Copyright &copy; ';
echo date('Y');
echo ' &middot; <a href="http://mydomain.com">My Custom Link</a> &middot; Built on the <a href="http://www.studiopress.com/themes/genesis" title="Genesis Framework">Genesis Framework</a>';
@srikat
srikat / functions.php
Created December 15, 2013 08:05
Moving Footer widgets and Footer outside Site Container in Lifestyle Pro (Genesis)
//* Reposition the footer widgets
remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
add_action( 'genesis_after', 'genesis_footer_widget_areas' );
//* Reposition the footer
remove_action( 'genesis_footer', 'genesis_footer_markup_open', 5 );
remove_action( 'genesis_footer', 'genesis_do_footer' );
remove_action( 'genesis_footer', 'genesis_footer_markup_close', 15 );
add_action( 'genesis_after', 'genesis_footer_markup_open', 11 );
add_action( 'genesis_after', 'genesis_do_footer', 12 );
@iksose
iksose / restAPI.markdown
Last active September 21, 2023 06:39
Creating a REST API using Node.js, Express, and MongoDB

###Creating a REST API using Node.js, Express, and MongoDB

####Installing Node.js

Go to http://nodejs.org, and click the Install button. Run the installer that you just downloaded. When the installer completes, a message indicates that Node was installed at /usr/local/bin/node and npm was installed at /usr/local/bin/npm. At this point node.js is ready to use. Let’s implement the webserver application from the nodejs.org home page. We will use it as a starting point for our project: a RESTful API to access data (retrieve, create, update, delete) in a wine cellar database.

Create a folder named nodecellar anywhere on your file system. In the wincellar folder, create a file named server.js.

@tamitutor
tamitutor / osx-mongodb-rlimits-fix.md
Last active November 8, 2023 09:23
Fix Mongodb "soft rlimits" Warning On Mac OS X (Yosemite)

If you are seeing Mongo soft rlimits warnings in your logs, or a WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 when you login to mongo shell via mongo from the commandline, or any mysterious/unexplained mongo connection errors... follow this how-to exactly and it will resolve the issue for you.

(Source of this how to found at basho/basho_docs#1402)

First file: sudo vi /Library/LaunchDaemons/limit.maxfiles.plist

...containing:

@wpscholar
wpscholar / array-insert-after.php
Created November 7, 2015 13:04
Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended to the end of the array.
<?php
/**
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
* to the end of the array.
*
* @param array $array
* @param string $key
* @param array $new
*
@ethanstenis
ethanstenis / Postman POST PUT Requests.txt
Last active May 13, 2024 13:07
How to make Postman work with POST/PUT requests in Laravel...
To make Postman work with POST/PUT requests...
https://laravel.com/docs/5.2/routing#csrf-x-csrf-token
In addition to checking for the CSRF token as a POST parameter, the Laravel VerifyCsrfToken middleware will also check for the X-CSRF-TOKEN request header.
1. Store the token in a "meta" tag at the top of your root view file (layouts/app.blade.php)...
<meta name="csrf-token" content="{{ csrf_token() }}">
** If using jQuery, you can now instruct it to include the token in all request headers.
$.ajaxSetup({
@kenmasters
kenmasters / GFORM SIN
Created August 30, 2017 13:02
Creating a custom gravityform field (Canada SIN [Standard Insurance Number])
/*******/
class GF_Field_SIN extends GF_Field {
public $type = 'sin';
public function get_form_editor_field_title() {
return esc_attr__( 'SIN', 'gravityforms' );
@kenmasters
kenmasters / Using TWBS to WP
Last active December 7, 2017 02:04 — forked from mrbobbybryant/gist:83c4a076da6dd67de3da
Properly enqueue Bootstrap(CSS/JS) into WordPress CMS
<?php
/**
* Enqueue scripts and styles
*/
add_action( 'wp_enqueue_scripts', 'your_theme_enqueue_scripts' );
function your_theme_enqueue_scripts() {
// all styles
wp_enqueue_style( 'bootstrap', get_stylesheet_directory_uri() . '/css/bootstrap.css', array(), 20141119 );
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
Reference: https://davidwalsh.name/query-string-javascript
How to use ?
// Assuming "?post=1234&action=edit"