This file contains hidden or 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
Show hidden characters
| [ | |
| { "keys": ["ctrl+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false} }, | |
| { "keys": ["ctrl+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true} } | |
| ] |
This file contains hidden or 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
| fn heap_sort<T: Ord>(a: &mut [T]) { | |
| let count:uint = a.len(); | |
| // first place 'a' in max-heap order | |
| heapify(a, count); | |
| let mut end = count - 1; | |
| while end > 0 { | |
| // swap the root (maximum value) of the heap with the | |
| // last element of the heap |
This file contains hidden or 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
| fn main() { | |
| let mut list = [1u, 5, 2, 7, 3, 9, 4, 6, 8]; | |
| bubble_sort(list); | |
| println!("After sort: {}", list.as_slice()); | |
| let mut list = ['a', 'z', 'd', 'e', 'x', 'a']; | |
| bubble_sort(list); | |
| println!("After sort: {}", list.as_slice()); | |
| } |
This file contains hidden or 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 std::fmt::Show; | |
| fn main() { | |
| println!("After sort: {}", quick_sort(vec!(1u, 5, 2, 7, 3, 9, 4, 6, 8))); | |
| println!("After sort: {}", quick_sort(vec!(1u, 2, 3, 4, 5, 6, 7, 8, 9))); | |
| println!("After sort: {}", quick_sort(vec!(9u, 8, 7, 6, 5, 4, 3, 2, 1))); | |
| } | |
| fn quick_sort<T: Clone + Show + PartialOrd>(a: Vec<T>) -> Vec<T> { | |
| if a.len() <= 1 { |
This file contains hidden or 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
| fn main() { | |
| let list: Vec<u64> = vec![1, 2, 3, 6, 8, 8, 4, 5, 99, 234, 4, 1, 2, 45]; | |
| let sorted = sort(list); | |
| println!("sorted: {}", sorted); | |
| // sorted: [1, 1, 2, 2, 3, 4, 4, 5, 6, 8, 8, 45, 99, 234] | |
| } | |
| fn sort<T: Clone + PartialOrd>(list: Vec<T>) -> Vec<T> { | |
| if list.len() <= 1 { |
This file contains hidden or 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
| fn main() { | |
| let mut list = vec![9_u64, 12, 3, 1, 6, 8, 2, 5, 14, 13, 11, 7, 10, 4, 0]; | |
| println!("Test - Before sort: {}", list); | |
| merge_sort(0, list.len() as u64, &mut list); | |
| println!("Test - After sort: {}", list); | |
| // Test - Before sort: [9, 12, 3, 1, 6, 8, 2, 5, 14, 13, 11, 7, 10, 4, 0] | |
| // Test - After sort: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
| } | |
This file contains hidden or 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
| <link rel="import" href="../core-scaffold/core-scaffold.html"> | |
| <link rel="import" href="../core-header-panel/core-header-panel.html"> | |
| <link rel="import" href="../core-menu/core-menu.html"> | |
| <link rel="import" href="../core-item/core-item.html"> | |
| <link rel="import" href="../core-icon-button/core-icon-button.html"> | |
| <link rel="import" href="../core-toolbar/core-toolbar.html"> | |
| <link rel="import" href="../core-menu/core-submenu.html"> | |
| <polymer-element name="my-element"> |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "github.com/codegangsta/negroni" | |
| "github.com/julienschmidt/httprouter" | |
| "net/http" | |
| ) | |
| func main() { |
This file contains hidden or 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
| package main | |
| import ( | |
| "github.com/codegangsta/martini" | |
| "github.com/martini-contrib/oauth2" | |
| "github.com/martini-contrib/sessions" | |
| ) | |
| func main() { | |
| m := martini.Classic() |
This file contains hidden or 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
| PUT music | |
| PUT music/song/_mapping | |
| { | |
| "song": { | |
| "properties": { | |
| "name": { | |
| "type": "string" | |
| }, | |
| "suggest": { |