Skip to content

Instantly share code, notes, and snippets.

View michaeldaw's full-sized avatar

Michael Daw michaeldaw

View GitHub Profile
@michaeldaw
michaeldaw / updateangular
Last active July 5, 2017 17:52
update angular
npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest --save
npm install @angular/cli@latest @angular/compiler-cli@latest @angular/language-service@latest [email protected] --save-dev
jquery typings:
typings install dt~jquery --global --save
@michaeldaw
michaeldaw / aurelia-typings.md
Last active January 17, 2017 05:27
updating typings aurelia-cli project to use aurelia-fetch-client

From aurelia/fetch-client#65

  1. Add missing typings
  • typings i dt~whatwg-fetch -GS
  • typings i dt~whatwg-streams -GS
  1. Create custom d.ts file for missing URLSearchParams. I added a aurelia-fetch-client-fix.d.ts file to the custom_typings folder declare type URLSearchParams = {}
  2. Add missing aurelia-fetch-client dependency in aurelia.json bundle config.
,
@michaeldaw
michaeldaw / shipping.php
Last active August 29, 2015 14:27
Shipping stuff
add_filter( 'woocommerce_package_rates', 'determine_shipping_rate', 10, 2 );
function determine_shipping_rate( $rates, $package ) {
// Set weight variable
$cart_weight = 0;
// Calculate cart's total
foreach( WC()->cart->cart_contents as $key => $value)
$cart_weight += $value['data']->weight * $value['quantity'];
if( $cart_weight > 45.45) { // may have to convert to pounds if necessary
# OSX
.DS_Store
# AppCode
.idea
# Xcode
build/
*.pbxuser
!default.pbxuser
@michaeldaw
michaeldaw / directions.swift
Created December 6, 2014 04:11
map kit directions
var pl = PlacemarkService()
var startPl: CLPlacemark!
var endPl: CLPlacemark!
var startLocation = CLLocation(latitude: 37.33, longitude: -122.03) //apple
var endLocation = CLLocation(latitude: 37.75, longitude: -122.43) //san fran
pl.RequestPlacemark(startLocation, callback: { (mark, error) -> Void in
@michaeldaw
michaeldaw / appDelegateCoreData.swift
Last active August 29, 2015 14:10
code to add Core Data to project in AppDelegate.swift file
private let modelName = "OnelessModel"
private let sqliteDbName = "onelessModel.sqlite"
// MARK: - Core Data stack
lazy var applicationDocumentsDirectory: NSURL = {
// The directory the application uses to store the Core Data store file. This code uses a directory named "com.meckd.coreDataTest" in the application's documents Application Support directory.
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
return urls[urls.count-1] as NSURL
}()