Skip to content

Instantly share code, notes, and snippets.

@tpai
tpai / angular.markdown
Last active May 17, 2017 04:14
Learning memo

AngularJS

Directives

  • ng-app="[MODULE_NAME]" // init angular
  • ng-controller="[CONTROLLER_NAME] as [ALIAS]" // init controller
  • ng-show="[CONDITION]" // show expression if true
  • ng-hide="[CONDITION]" // hide expression if true
  • ng-repeat="[ALIAS] in [CONTROLLER_NAME].[PROPERTY_NAME]" // for element in elements
  • ng-src="{{[CONTROLLER_NAME].[ARRAY][0]}}" // when load image in array
@37celsius
37celsius / CS_BJS_101.md
Last active May 18, 2017 14:07
Learning Backbone JS

Anatomy of Backbone JS 1

/* Welcome to the Anatomy of Backbone.js challenges! We're going to be building a simple Appointment app for our friend, Dr. Goodparts.

So, let's get started and create an Appointment model class.
*/

// Create a model class
var Appointment = Backbone.Model.extend({});
@bekarice
bekarice / wc-empty-cart-notice.php
Last active February 4, 2019 23:10
WooCommerce: Show a notice throughout the store if the cart is empty
/**
* Tutorial: http://www.skyverge.com/blog/check-if-woocommerce-cart-is-empty/
**/
function skyverge_empty_cart_notice() {
if ( WC()->cart->get_cart_contents_count() == 0 ) {
wc_print_notice( __( 'Get free shipping if your order is over $60!', 'woocommerce' ), 'notice' );
// Change notice text as desired
}
@gxespino
gxespino / ProgrammingManifesto.md
Last active February 4, 2021 01:01
Glenn's Path to Becoming a Ruby/Rails Programmer (Sept 2014 - Sept 2015)

#Programming Manifesto

##Books Ruby

  • Learn to Program by Chris Pine
  • The Well-Grounded Rubyist by David Black
  • Eloquent Ruby by Russ Olsen
  • Practical Object-Oriented Design in Ruby by Sandi Metz
  • Confident Ruby by Avdi Grimm
@bekarice
bekarice / edit-woocommerce-checkout-template.php
Last active November 9, 2025 10:21
Add content and notices to the WooCommerce checkout - sample code
/**
* Each of these samples can be used - note that you should pick one rather than add them all.
*
* How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96
* Tutorial: http://www.skyverge.com/blog/edit-woocommerce-templates/
**/
/**
* Add a content block after all notices, such as the login and coupon notices.
*
@mikejolley
mikejolley / gist:9971101
Created April 4, 2014 09:23
WC customising checkout fields using actions and filters - Lesson 3 snippet 1
/**
* Add the field to the checkout
*/
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' );
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h2>' . __('My Field') . '</h2>';
woocommerce_form_field( 'my_field_name', array(
@cubika
cubika / jquery.nivo.slider.js
Created October 5, 2013 07:55
nivo slider -- picture slide plugin
/*
* jQuery Nivo Slider v3.2
* http://nivo.dev7studios.com
*
* Copyright 2012, Dev7studios
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function($) {
@lnmunhoz
lnmunhoz / theReturnFlight1-6.js
Last active May 1, 2017 22:08
You've decided you only want to get photos of london. Use the data option of the $.ajax function to pass a location option. Get the location from the data-location on the #tour element using the data method.
DOM :
<div id="tour" data-location="london">
<button>Get Photos</button>
<ul class="photos">
</ul>
</div>
JS:
$(document).ready(function() {
var el = $("#tour")
@codeschool-courses
codeschool-courses / style.css
Created April 10, 2012 18:20
Journey Into Mobile - Challenge 1-3
body {
font-size: 62.5%; /* 1em = 10px */
}
h1 {
font-size: 2.4em; /* 24px / 10px */
}