View theme_name_scripts.php
This file contains 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 | |
/** | |
* Wordpress is @ 4.5.3 | |
* https://developer.wordpress.org/reference/functions/wp_style_add_data/ | |
* https://developer.wordpress.org/reference/functions/wp_script_add_data/ | |
* no need to use global $wp_data | |
* add to your theme's functions.php file | |
* */ | |
define('THEME_TEMPLATE_PATH', get_template_directory_uri()); |
View app.js
This file contains 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 () { | |
'use strict'; | |
angular | |
.module('va', []) | |
.filter('highlight', highlight) | |
.factory('query', query) | |
.controller('searchlist', searchList); | |
highlight.$inject = ['$sce']; | |
function highlight($sce) { |
View fizzbuzz.html
This file contains 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
<ul id="fizzbuzz"> | |
</ul> | |
<script type="text/javascript" src="fizzbuzz.js"></script> |
View flattened.js
This file contains 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
/** | |
* Write some code, that will flatten an array of arbitrarily nested arrays of integers into a | |
* flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4]. | |
**/ | |
/** | |
* forEach solution | |
**/ | |
const FlatLinerFE = function(arr) { | |
let flatline = []; |
View es6-int-classes-initial-code.js
This file contains 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 strict'; | |
const Felidea = function() { | |
const bigCats = ['tiger','lion','jaguar', 'leopard', 'snow leopard']; | |
const midSize = ['clouded leopard', 'sunda clouded leopard']; | |
let species = Object.freeze([...bigCats, ...midSize]); | |
return species; | |
} | |
const Panthera = function(kind, name, options) { | |
// check if the kind belong to the species list |
View findMissinNumber.js
This file contains 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
var findMissingNumber = function(arr) { | |
let size = arr.length; | |
console.log(size); | |
if(!size) { | |
return false; | |
} | |
// could sort the array first and get | |
// first and last index | |
// not sure which one would be faster | |
//let lower = Math.min.apply(null, arr); |
View isPalindrome.js
This file contains 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
String.prototype.isPalindrome = function() { | |
let specialChars = /[`~!@#$%^&*()_|+\-=?;’—:'",.<>\{\}\[\]\\\/]/gi; | |
let prepped = this.replace(specialChars, '').replace(/\s/g, '').toLowerCase(); | |
return ( prepped === prepped.split('').reverse().join('') ) | |
}; | |
console.log("Matam", "Matam".isPalindrome()); // true | |
console.log("racecar", "racecar".isPalindrome()); // true | |
console.log("race car", "race car".isPalindrome()); // true |
View binary-gap-solution.js
This file contains 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 solution(N) { | |
const nope = 0; | |
if(!N) return nope; | |
let bin = (N >>> 0).toString(2); | |
let binLength = bin.length; | |
View odd-occurences-in-array.js
This file contains 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 solution(A) { | |
return A.reduce( (a,c) => a ^= c ); // xor operator is sexy :) | |
} | |
var barr = [10,10, 4, 3, 4, 6, 8, 8, 6]; | |
console.log(solution(barr)); // returns 3; |
View frogJump.js
This file contains 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 solution(X, Y, D) { | |
// write your code in JavaScript (Node.js 6.4.0) | |
if( D <= 0 || Y <= X ) return 0; | |
var J = Math.ceil( ( Y - X) / D ); | |
return J; | |
} | |
console.log( solution(10, 85, 30) ); // 3 |
OlderNewer