This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
if (site_config('agentactivation')) { | |
add_action('init',array(&$this,'create_post_type')); | |
//add_action('init',array(&$this,'create_taxonomy')); | |
//add_filter('post_type_link',array(&$this,'filter_post_link'),10,2); | |
if (is_admin()) $this->admin_init(); | |
else $this->public_init(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($_SERVER['HTTP_HOST']=='site1.example.com') | |
define('WP_DEBUG', true); | |
else | |
define('WP_DEBUG', false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// creates categories based on cpt (parent posts only) | |
function create_categories_based_on_ctp() { | |
// cpt you are coping posts from | |
$cccpt_posts = array( 'post_type' => 'ctp', 'posts_per_page' => -1 ); | |
$cccpt_postslist = get_posts( $cccpt_posts ); | |
// cpt you are adding categories to | |
$cccpt_cpt_destination = ''; // example: 'communites' | |
$cccpt_cpt_description_description = ''; // example: 'this is for communities' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get's list of urls, grabs the title in json, and appends them to a selector of your choice | |
function requester(urls, selector) { | |
if(urls === undefined || urls.length === 0) { | |
return; | |
} | |
var request = new XMLHttpRequest(); | |
request.open('GET', urls[0]); | |
request.responseType = 'json'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get data from list of URL's in asynchronous. | |
function asyncRequester(url) { | |
return new Promise((resolve, reject) => { | |
const xhr = new XMLHttpRequest(); | |
xhr.open("GET", url); | |
xhr.onload = () => resolve(xhr.responseText); | |
xhr.onerror = () => reject(xhr.statusText); | |
xhr.send(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get data from list of URL's in asynchronous. | |
function asyncRequester(url) { | |
return fetch(url).then((response) => response.json()); | |
} | |
var urls = ['temp.json', 'temp.json', 'temp.json', 'temp.json', 'temp.json'], | |
pall = [], | |
resu = document.querySelector('#results'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def printCharPermutations(word): | |
print('') # 0 | |
if len(word) == 1: # 1 | |
print(word[0]) | |
return | |
printCharPermutationsHelper('', word, len(word)) | |
def printCharPermutationsHelper(currentPermutation, lettersICanUse, maxLen): # 3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { addPositiveNumbers } from '../index'; | |
import * as IsPositiveNumber from "../isPositiveNumber"; | |
IsPositiveNumber.isPositiveNumber = jest.fn(); | |
describe('addPositiveNumbers', () => { | |
afterEach(() => { | |
jest.clearAllMocks(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { add } from '../index'; | |
import { addPositiveNumbers } from '../index'; | |
import { addListItem} from '../index'; | |
import { commaSeparatedStringToArray } from '../index'; | |
import * as IsPositiveNumber from "../isPositiveNumber"; | |
import { latestRollingStoneArticleTitle } from '../index'; | |
IsPositiveNumber.isPositiveNumber = jest.fn(); | |
describe('add', () => { |