This file contains 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
[3,5].map { |n| n.step(max, n).to_a }.reduce(:|).reduce(0,:+) |
This file contains 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
var account = (function(startingBalance) { | |
var balance = startingBalance; | |
function getBalance() { | |
return balance; | |
} | |
function deposit(amount) { | |
balance += amount; |
This file contains 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
// scala | |
// adding interfaces to classes | |
trait Greetable { | |
def Greeting: String | |
} | |
def greet(g: Greetable): Unit = { | |
println(g.Greeting) | |
} |
This file contains 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
var db = new PortalContext(); | |
var profile = new Profile() | |
{ | |
Id = 20, | |
FirstName = "Tyler", | |
LastName = "Durden" | |
}; | |
db.Entry(profile).State = EntityState.Modified; |
This file contains 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
Imports System.Data.Entity | |
Imports System.ComponentModel.DataAnnotations | |
Imports System.ComponentModel.DataAnnotations.Schema | |
Public Class PartContext | |
Inherits DbContext | |
Public Sub New() | |
MyBase.New("Data Source=(local);Initial Catalog=TestDB;Trusted_Connection=True;") | |
End Sub |
This file contains 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
## env.rb ## | |
PageObject.javascript_framework = :jquery | |
## login.rb ## | |
class LoginPage | |
include PageObject | |
## stuff for every page ## |
This file contains 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
angular.module('ymusica').controller('AlbumSearch', ['$scope', 'Albums', 'Artists', '$q', function($scope, albums, artists, $q) { | |
$scope.albums = []; | |
$scope.artists = []; | |
var terms = new Rx.Subject(); | |
$scope.searchMusic = terms.onNext.bind(terms); | |
terms.sample(250) |
This file contains 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
// is there a way to make this an awesome for comprehension or whatever? | |
// or maybe a built in Map method to do what I want? ;p | |
val codes: List[String] = ... | |
val configs: Map[String, Configuration] = ... | |
val defaultConfig: Configuration = ... | |
val config: Configuration = codes | |
.find(configs.contains) // find the first code that the configs map contains | |
.flatMap(configs.get) // grab the config for that first code |
This file contains 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
{:name nil | |
:description nil | |
:email nil | |
:repositories {:count nil | |
:filters {:first {:count 50} | |
:after {:cursor 22046023}} | |
:edges {:cursor nil | |
:node {:id nil | |
:name nil | |
:full_name nil |
This file contains 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
(defn paged-http-get | |
([url] | |
(paged-http-get url 1)) | |
([url page] | |
(let [sink (s/stream)] | |
(d/loop [page page] | |
(d/chain (http-get url {:query-params {"page" page}}) | |
(fn [response] | |
(let [body (:body response)] | |
(if (seq body) |