Skip to content

Instantly share code, notes, and snippets.

View nem035's full-sized avatar
🐢
always learning

Nemanja Stojanovic nem035

🐢
always learning
View GitHub Profile
@nem035
nem035 / application.controller.js
Last active November 5, 2016 02:54
custom helper
import Ember from 'ember';
export default Ember.Controller.extend({
selectedMenuIndex: 0,
menuItems: [
{ text: 'A' },
{ text: 'B' }
],
actions: {
selectMenuItem: function(itemIndex) {
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
callStore() {
this.store.customMethod();
}
}
});
@nem035
nem035 / application.controller.js
Created February 3, 2016 17:02
<select> example
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
actions: {
selectOption(option) {
alert(option);
}
}
});
@nem035
nem035 / application.controller.js
Last active March 8, 2016 05:55
Double each - dynamic binding
import Ember from 'ember';
export default Ember.Controller.extend({
rows: [],
headers: [],
header1: 'title',
header2: 'description',
onHeadersChange: Ember.observer('header1', 'header2', function() {
var a = document.createElement("a");
a.href = "http://infrequently.org/2012/04/bedrock/#comments";
console.log(a.protocol, a.host, a.pathname, a.hash);
@nem035
nem035 / The Technical Interview Cheat Sheet.md
Created May 31, 2016 14:37 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
import Ember from 'ember';
const {
get,
set,
Component
} = Ember;
export default Component.extend({
@nem035
nem035 / html-code-scrapper.js
Last active July 2, 2016 03:14
Simple script to run in the browser console at http://www.ascii.cl/htmlcodes.htm and obtain the ascii data by its type.
// object that will contain the data
var result = {
dec: [],
hex: [],
symbols: [],
htmlNums: [],
htmlNames: [],
names: []
};
@nem035
nem035 / classical.js
Last active July 26, 2016 20:15
JavaScript OOP Patterns
function Creature(data = {}) {
// private properties
let { age = 0 } = data;
// public methods
this.getAge = function() {
return age;
};
@nem035
nem035 / es5-algorithm-double-equals.js
Last active July 19, 2016 03:33
(Loose) implementations of the double equals (==) and triple equals (===) algorithms in JavaScript (ES5 & ES6), showing the steps the JavaScript engine takes to evaluate both operations and how the operations are related. The only major ES6 addition for both operations is handling of Symbols.
// An implementation of the double equals (==) algorithm in JavaScript ES5
// Spec: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
function doubleEquals(x, y) {
// if x and y have the same type
if (areSameType(x, y)) {
// return the === comparison (based on the spec, this should run the code from step 2 of the === algorithm but this is a cleaner representation)
return tripleEquals(x, y);
}
// x and y have a different type