Description of changes
None
( add screenshot here )
| // just pass in the attribute and the attribute slug | |
| // and the return value is the attribute's name | |
| // example : (assuming attribute size has the option of "Extra Small" withe the slug of "extra-small") | |
| // echo attribute_slug_to_title('attribute_pa_size', 'extra-small'); | |
| // returns | |
| // "Extra Small" | |
| // code reworked from woocommerce/classes/class-wc-cart.php |
| <div class="grid"> | |
| <header>Header</header> | |
| <aside>Aside</aside> | |
| <main>Main</main> | |
| <footer>Footer</footer> | |
| </div> |
Description of changes
None
( add screenshot here )
| const getUrlParamsObj = (queryString) => { | |
| const paramsArray = (window.location.search.charAt(0) === "?") | |
| ? window.location.search.substr(1).split('&') | |
| : window.location.search.split('&') | |
| return paramsArray.reduce((mainObj, val) => { | |
| const valArray = val.split('=') | |
| return Object.assign(mainObj, {[valArray[0]]: valArray[1]}) | |
| }, {}) | |
| } |
| const myObj = { | |
| list: [ | |
| {name: 'bill'}, | |
| {name: 'fred'}. | |
| ], | |
| }; | |
| const newObj = { | |
| ...myObj, | |
| list: myObj.list.concat({name: 'sam'}) |
| # Still working on this. | |
| # the element with the class 'hero-paralax' will be targeted, setting the variable | |
| $hero_paralax = $('.hero-paralax') | |
| # watching for scrolling | |
| $(@).scroll () => | |
| # set scroll top position | |
| scroll_top = $(@).scrollTop() | |
| # set new bg position (moves down at half the speed of scrolling |
| # start at the top | |
| scroll_top = 0 | |
| # on the scroll | |
| $(@).scroll () => | |
| scroll_top = $(@).scrollTop() | |
| # log it | |
| console.log scroll_top |
| # just copy and paste and you have the quick bones for a CoffeeScript Swtich statement | |
| # 'day' is the variable you are checking | |
| switch day | |
| when "Fri" then 'yeah' | |
| else 'dang' |
| // usage | |
| // just call rekey_array_keys_to_defaults( $my_array ); | |
| // this function call will return the same array in the same order | |
| // but with new keys. The new keys are the default array keys | |
| // i.e. [0,1,2] | |
| function rekey_array_keys_to_defaults($array_to_rekey) { | |
| $rekeyed_array = array(); | |
| foreach ($array_to_rekey as $key => $value) { | |
| array_push($rekeyed_array, $value); |
| $ () -> #jQuery starter upper! | |
| # browser window var | |
| $browser_window = $(window) | |
| # function | |
| window_info = -> | |
| console.log '----------------BROWSER WIDTH AND HEIGHT-------------------' | |
| console.log $browser_window.width()+' is the browser width || '+$browser_window.height()+' is the browser height' | |
| # function call | |
| window_info() |