Skip to content

Instantly share code, notes, and snippets.

View lynnetye's full-sized avatar

Lynne Tye lynnetye

  • San Francisco, CA
View GitHub Profile
@lynnetye
lynnetye / ember-trix-editor-README.js
Created October 21, 2015 08:54
code snippet for the ember trix editor readme (re: jQuery events)
actions: {
handleTrixAttachmentAdd(jqEvent) {
var attachment = jqEvent.originalEvent.attachment;
if (attachment.file) {
// update file to server
// call attachment.setAttributes();
}
}
}
<input id={{inputId}}
type="hidden"
name="content"
value={{attrs.value}}>
<trix-editor autofocus={{autofocusOn}}
class={{attrs.editorClass}}
input={{inputId}}
placeholder={{attrs.placeholder}}></trix-editor>
import Ember from 'ember';
export default Ember.Component.extend({
attachmentsDisabled: false,
editor: null,
excludeInput: false,
inputId: 'trix-editor-input-id',
SELECT * FROM users;
INSERT INTO users
(first_name, last_name, email, created_at, updated_at)
VALUES
('Lynne', 'Tye', 'lynnetye@gmail.com',DATETIME('now'), DATETIME('now'));
ALTER TABLE users
ADD COLUMN nickname VARCHAR(64) NOT NULL DEFAULT ' ';
class Stack
def initialize(max_size)
@store = []
@max_size = max_size
end
def push(x)
raise "Stack Overflow - The stack is full" if self.full?
@store.push x
end
Method: Zip
Class: Array (of first and last names)
Format: array1.zip(array2)
Block: none
Result: array of duplets
first_names = ["Lynne", "Lawrence", "Emily", "Leandra"]
last_names = ["Tye", "Yu", "Gerngross", "Kim"]
full_names = first_names.zip(last_names)
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
</head>
<body>
<h1>5 Things I Love and Live By</h1>
<p class="header">something</p>
document.getElementById("unicorn")
document.getElementsByClassName("paragraph-header")
document.getElementsByTagName("p")[0].innerHTML = "Update text."
def find_factorial(num)
answer = 1
num.downto(1) { |x| answer *= x }
return answer
end
p find_factorial(6) # 720
(6 factorial)
6 * (5 factorial)
6 * (5 * (4 factorial))
6 * (5 * (4 * (3 factorial)))
6 * (5 * (4 * (3 * (2 factorial))))
6 * (5 * (4 * (3 * (2 * (1 factorial)))))
6 * (5 * (4 * (3 * (2 * (1)))))
6 * (5 * (4 * (3 * (2))))
6 * (5 * (4 * (6)))
6 * (5 * (24))