Update and upgrade
sudo apt update
sudo apt -y upgrade
sudo apt install -y vim
Install git
import LinkedListNode from './linkedListNode'; | |
export default class LinkedList { | |
private headSentinel; | |
constructor() { | |
this.headSentinel = new LinkedListNode(null); | |
} | |
head() { |
angular.module('Hangman', []); | |
angular.module('Hangman') | |
.controller('GameCtrl', function() { | |
var game = this; | |
game.word = "SINGLETON"; | |
game.allChars = game.word.split(""); | |
game.chars = []; | |
angular.forEach(game.allChars, function(char) { | |
game.chars.push({ |
def check_sub_pattern?(big_grid, small_grid) | |
big_r = big_grid.length | |
small_r = small_grid.length | |
big_c = big_grid[0].length | |
small_c = small_grid[0].length | |
(0..(big_r-small_r)).each do |r| | |
(0..(big_c-small_c)).each do |c| | |
pattern_found = true | |
(0...small_r).each do |i| | |
break if !pattern_found |
function deepEqualObjects(a,b) { | |
for(var prop in a) { | |
if(!deepEqual(a[prop],b[prop])) { | |
return false; | |
} | |
} | |
for(var prop in b) { | |
if(!deepEqual(a[prop],b[prop])) { | |
return false; | |
} |
function arrayToList(arr) { | |
var list = null; | |
for(var i = arr.length -1; i >= 0; i--) { | |
list = { | |
value: arr[i], | |
rest: list | |
}; | |
} | |
return list; |
<%= simple_form_for @new_message, remote: true, html: {class: "form-inline"} do |f| %> | |
<%= f.input :note, label: false, placeholder: "Enter Message", input_html: { id: "note_input" } %> | |
<%= f.input :owner_id, as: :hidden %> | |
<%= f.submit 'Submit', hidden: true %> | |
<% end %> |
$('.flash_messages').html('<%= j flash_tag("Access Denied!", "alert") %>') |
This gist tries to give an example of how to build a simple, yet robust, messaging system. | |
We assume that the users are handed by `User` model. | |
The following models are proposed: | |
Conversation::Thread | |
Conversation::ThreadSubscription | |
Conversation::Message | |
Conversation::MessageSubscription |
/** | |
* Add dataset support to elements | |
* No globals, no overriding prototype with non-standard methods, | |
* handles CamelCase properly, attempts to use standard | |
* Object.defineProperty() (and Function bind()) methods, | |
* falls back to native implementation when existing | |
* Inspired by http://code.eligrey.com/html5/dataset/ | |
* (via https://github.com/adalgiso/html5-dataset/blob/master/html5-dataset.js ) | |
* Depends on Function.bind and Object.defineProperty/Object.getOwnPropertyDescriptor (shims below) | |
* Licensed under the X11/MIT License |