Skip to content

Instantly share code, notes, and snippets.

View sekharp's full-sized avatar
💭
Stay-At-Home 🐶 Parent

Sekhar Paladugu sekharp

💭
Stay-At-Home 🐶 Parent
View GitHub Profile
class RetailerAccountRepository < Repository[:retailer_accounts]
def find_by_account_id(account_id)
retailer_accounts.where(Sequel[:retailer_accounts][:account_id] => account_id)
end
def find_by_retailer_id(id)
retailer_accounts.where(retailer_id: id)
end
end
module Entities
class Visitor < Franchises::Struct
def verified?
!verified_at.nil?
end
end
end
resources :products, only: [:show]
get ‘/style-guide’, to: ‘style_guides#show’
@sekharp
sekharp / js-exercisms.md
Last active February 26, 2016 17:32
Initial JavaScript Exercism Comparisons Homework - Mod 4 at Turing

##Leap My code: here

  • Responder #1 (here) - A very similar one line solution to mine.
  • Responder #2 (here) - Same story here.
  • Responder #3 (here) - This solution did not define the function on a prototype, which is a best practice. Will need to be called much more often when used is my understanding.
  • Responder #4 (here) - Could have had the conditionals bunched into two branches, rather than three, using the && to combine two true statements.
  • Responder #5 (here) - Verbose solution that similarly could’ve simplified the conditional.

##Hamming My code: [here](http://exercism.io/submissions/6c80591ffa814b3f97

// aka root component
var Dashboard = React.createClass({
getInitialState: function() {
return { headerIsActive: false }
},
onButtonClick: function() {
console.log('in DASHBOARD!!');
},

Step One: Watch Writing Testable JavaScript - Rebecca Murphey from Full Frontal 2012 (award for worst conference name ever?)

Step Two: Fork this gist.

Step Three: Consider the four responsibilities that Rebecca lists for client side code (hint: they're color coded).

Did any of the responsibilities that she lists surprise you?

  • It's helpful for me to see what Rebecca lists here as best practices. I'm new to JavaScript and hearing what experienced developers see as important rules to follow gives me structure. None of them surprised me per se. It did take me a little while to understand "Application State."
@sekharp
sekharp / require.markdown
Last active February 16, 2016 22:13 — forked from rrgayhart/require.markdown
The Concept of Require

When you start working with WebPack for GameTime, you'll notice that you can't just define a variable in one file and find it in another as easily as you can in Rails.

Read Node.js, Require and Exports and Organize Your Code with RequireJS

Fork this gist and answer the following questions:

  • In the context of Node, what is a module? A module is the fundamental building block of node which maps directly to a file. A module can be a container of exported values or not.
**Step One**: Watch [Sorting Algorithms in JavaScript](https://www.youtube.com/watch?v=uRyqlhjXYQI)
**Step Two**: Fork this gist.
**Step Three**: Respond to this question in your fork: "What are some of the balances and trade offs between different sorting algoritms?"
-It all depends on what type of data you're sorting and whether you're trying to optimize for use of memory/computing power
-Bubble sort is useful to study but generally not useful in real world application. They're slow and take a lot of memory
-Insertion sorts are better in that they're more stable, but for application on large datasets are still bad
-Merge sort is all around the best, but highly data intensive. Definitely the best option with a lot of computing power.

I can explain how the new keyword changes the way a function behaves.

I can explain the implicit steps that happen in my function when I use the new keyword.

I can explain the difference between an object's prototype and the prototype property on the constructor function.

I understand how to place method on a prototype.

I understand the difference between using Object.create and using a