Skip to content

Instantly share code, notes, and snippets.

View trys's full-sized avatar
🤓
🚀

Trys Mudford trys

🤓
🚀
View GitHub Profile
@trys
trys / thirteen.js
Created September 22, 2015 20:16
Problem Thirteen
var numberArray = [
37107287533902102798797998220837590246510135740250,
46376937677490009712648124896970078050417018260538,
74324986199524741059474233309513058123726617309629,
91942213363574161572522430563301811072406154908250,
23067588207539346171171980310421047513778063246676,
89261670696623633820136378418383684178734361726757,
28112879812849979408065481931592621691275889832738,
44274228917432520321923589422876796487670272189318,
47451445736001306439091167216856844588711603153276,
@trys
trys / fourteen.js
Created September 22, 2015 19:44
Problem Fourteen
var termCount = 1,
termTotal = 1,
termIndex = 0;
current = 13,
discountable = {};
for ( var i = 1; i < 1000000; i++ ) {
current = i;
if ( ! ( current in discountable ) ) {
while ( current != 1 ) {
@trys
trys / heights.js
Created April 10, 2015 17:12
Match column heights
MatchColumnHeights: function( group, width ) {
var tallest = 0,
gCount,
subGroup,
splitGroup,
i;
splitGroup = [];
@trys
trys / top-cart.php
Last active August 29, 2015 14:18
Top Cart
<?php
/**
* Ajax top-cart
*
* @param array $fragments
* @return array
*/
function projectnamespace_woocommerce_ajax_top_cart( $fragments ) {
ob_start();
get_template_part( 'views/top-cart' );
@trys
trys / social.php
Created April 10, 2015 17:00
Social icons
<ul class="social-icons">
<?php
echo ( $st = get_field( 'twitter', 'options' ) ) ? '<li><a target="_blank" href="' . $st . '"><i class="fa fa-twitter"></i></a></li>' : '';
echo ( $sf = get_field( 'facebook', 'options' ) ) ? '<li><a target="_blank" href="' . $sf . '"><i class="fa fa-facebook"></i></a></li>' : '';
echo ( $sy = get_field( 'youtube', 'options' ) ) ? '<li><a target="_blank" href="' . $sy . '"><i class="fa fa-youtube"></i></a></li>' : '';
echo ( $sl = get_field( 'linkedin', 'options' ) ) ? '<li><a target="_blank" href="' . $sl . '"><i class="fa fa-linkedin"></i></a></li>' : '';
?>
</ul>
@trys
trys / functions.php
Created April 10, 2015 16:58
Change WooCommerce text strings
/**
* Change WooCommerce text strings.
*
* @param string $translated
* @param string $text
* @param string $domain
* @return string
*/
function projectnamespace_woocommerce_text( $translated, $text, $domain ) {
if ( $domain === 'woocommerce' ) {
@trys
trys / product.php
Created April 10, 2015 16:47
Responsive WooCommerce product gallery
/**
* Product Images
*
* @return void
*/
function projectnamespace_product_images() {
global $post, $product;
echo '<div class="images clear">';
@trys
trys / functions.php
Created April 10, 2015 16:36
Add metabox to WordPress
/**
* Add Meta Box
*
* @return void
*/
function projectnamespace_add_meta_box() {
add_meta_box(
'projectnamespace_meta_box_id',
'Meta box title',
@trys
trys / functions.php
Created April 10, 2015 16:28
Add field to WooCommerce product information panel
/**
* Add field to product options
*
* @return void
*/
function projectnamespace_add_product_fields() {
woocommerce_wp_checkbox(
array(
'id' => '_projectnamespace_enquiry_only',
@trys
trys / twelve.js
Created April 8, 2015 16:49
Problem Twelve
var count = 1,
divisors = 0,
currentTriangle = 0;
while ( divisors <= 500 ) {
currentTriangle += count;
divisors = 0;
for ( var k = 1; k < currentTriangle / 2; k++ ) {