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
(defun find-idx-of-max (list) | |
(let ((max_i 0) (val) (max)) | |
(dotimes (i (length list) max_i) | |
(setq val (nth i list)) | |
(setq max (nth max_i list)) | |
(when (> val max) (setq max_i i)) | |
) | |
) | |
) |
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
(defun read-words-from-file (file-path) | |
(with-temp-buffer | |
(insert-file-contents file-path) | |
(mapcar 'string-to-number (split-string (buffer-string) "\n" t)) | |
) | |
) | |
(read-words-from-file "./input.txt") | |
(defun escape-maze (list) |
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
(defun read-words-from-file (file-path) | |
(with-temp-buffer | |
(insert-file-contents file-path) | |
(mapcar 'split-string (split-string (buffer-string) "\n" t)) | |
) | |
) | |
(defun is-all-unique (list predicate) | |
(let ((n (1- (length list))) (has-similar)) | |
(loop |
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
(defun size-of-square (N) | |
(let ((d 1)) | |
(loop | |
(when (>= (* d d) N) (return d)) | |
(setq d (+ d 2)) | |
) | |
) | |
) | |
(defun generate-empty-square (size) |
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
(defun read-numbers-from-file (file-path) | |
(with-temp-buffer | |
(insert-file-contents file-path) | |
(mapcar | |
(lambda (arg) (mapcar 'string-to-number(split-string arg))) | |
(split-string (string-trim (buffer-string)) "\n" t) | |
) | |
) | |
) |
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
;; Part 1 | |
(defun sum (list) | |
"Solution for Part #1 http://adventofcode.com/2017/day/1" | |
(let ((s 0) next-i next val (n (length list))) | |
(dotimes (i n) | |
(progn | |
(setq val (nth i list)) | |
(setq next-i (+ i 1)) | |
(when (= next-i n) (setq next-i 0)) | |
(setq next (nth next-i list)) |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
tagName: 'span', | |
actions: { | |
highlight(part, event) { | |
this.get('message').forEach((part) => { | |
part.set('isHighlighted', false); | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
actions: { | |
insert(){ | |
// set timeout is used intentionally | |
// (instead of Ember.run.later) | |
setTimeout(()=>{ |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
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
Ember.Application.initializer({ | |
name: 'authenticated-routes', | |
after: 'simple-auth', | |
initialize: function(container, application) { | |
var routeNames = Object.keys(Teachertrainingv2.Router.router.recognizer.names), | |
routeObj = null; | |
var systemRoutes = ['loading', 'error', 'application']; | |
var routesWithoutAuth = systemRoutes.concat(Teachertrainingv2.ROUTES_NOT_REQUIRE_AUTHENTICATION); |