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 execute = function (method, availableParams, givenParams, callback) { | |
var request = require('request'); | |
var finalParams = { apikey: 'XXXXXXXX' }; | |
var currentParam; | |
for (var i = 0; i < availableParams.length; i++) { | |
currentParam = availableParams[i]; | |
if (typeof givenParams[currentParam] !== 'undefined') | |
finalParams[currentParam] = givenParams[currentParam]; | |
} |
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
$rootScope.safeApply = (fn) -> | |
phase = $rootScope.$$phase | |
if phase is "$apply" or phase is "$digest" | |
fn() if fn and (typeof (fn) is "function") | |
else | |
@$apply fn |
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
'use strict'; | |
angular.module('frontendApp') | |
.directive('chosen', function ($timeout) { | |
return { | |
restrict: 'A', | |
link: function postLink(scope, element, attrs) { | |
var deferChosen = function(){ | |
element.chosen({ |
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.element(document).ready(function() { | |
var initPromise = Kinvey.init({ | |
appKey : 'XXX-M', | |
appSecret : 'XXX' | |
}); | |
initPromise.then(function(activeUser) { | |
//save user in global variable | |
window.activeUser = activeUser; | |
//load my app |
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
public class MyEmberJsonMediaTypeFormatter : JsonMediaTypeFormatter | |
{ | |
private int _maxDepth = 256; | |
private JsonSerializerSettings _jsonSerializerSettings; | |
public MyEmberJsonMediaTypeFormatter() | |
{ | |
_jsonSerializerSettings = CreateDefaultSerializerSettings(); | |
} | |
public override System.Threading.Tasks.Task WriteToStreamAsync(System.Type type, object value, System.IO.Stream writeStream, System.Net.Http.HttpContent content, System.Net.TransportContext transportContext) | |
{ |
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
App.ArrayTransform = DS.Transform.extend({ | |
serialize: function(jsonData) { | |
if (Em.typeOf(jsonData) === 'array') { | |
return jsonData; | |
} else { | |
return []; | |
} | |
}, | |
deserialize: function(externalData) { | |
switch (Em.typeOf(externalData)) { |
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
def fizzbuzz n do | |
_fizzbuzz 1..n | |
end | |
defp _fizzbuzz a..n do | |
cond do | |
(rem(a,3) == 0 and rem(a,5) == 0) -> | |
IO.puts "fizzbuzz" | |
(rem(a,3) == 0) -> | |
IO.puts "fizz" |
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
def fizzbuzzNoCond n do | |
_fizzbuzzNoCondRange 1..n | |
end | |
defp _fizzbuzzNoCondRange(b..b) do | |
_fizzbuzzNoCond rem(b,3), rem(b,5), b | |
end | |
defp _fizzbuzzNoCondRange(a..b) do | |
_fizzbuzzNoCond rem(a,3), rem(a,5), a | |
_fizzbuzzNoCondRange (a+1)..b |
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
def list_concat a,b do a ++ b end | |
def list_sub a,b do a -- b end | |
#you can test this in iex | |
list_concat2 = &(&1 ++ &2) | |
list_concat2.([1,2],[3,4]) | |
list_sub2 = &(&1 -- &2) | |
list_sub2.([1,2,3,4], [3,9,8,2]) |
OlderNewer