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
// F# | |
type LinkedList<'a> = | |
| Nil | |
| Node of 'a * LinkedList<'a> | |
let head = | |
function | |
| Nil -> Nil | |
| Node(x, _) -> x |
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
let fizzBuzz attempt = | |
match attempt with | |
| (0, 0, _) -> "FizzBuzz" | |
| (0, _, _) -> "Fizz" | |
| (_, 0, _) -> "Buzz" | |
| (_, _, n) -> n.ToString() | |
for num in 1..100 do | |
printfn "%s" (fizzBuzz (num % 3, num % 5, num)) | |
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
function FingerprintWrapper(e) { | |
var t = null, | |
r = new n(); | |
c.rebuildXMLHttpRequest(e.ajax_header), c.fetchAjaxHeaders(e); | |
var d = function(n) { | |
if (!t) { | |
t = n ? n.type : "manual/other"; | |
var d = function(t) { | |
var r = a(); | |
if (r) { |
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
{ | |
"global": { | |
"check_for_updates_on_startup": true, | |
"show_in_menu_bar": true, | |
"show_profile_name_in_menu_bar": false | |
}, | |
"profiles": [ | |
{ | |
"complex_modifications": { | |
"parameters": { |
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
/** | |
* Check if the component disabled value is "truthy" | |
* | |
* This check is done here due to ngc throwing an error when the logic is in the template | |
* | |
* @param disabledValue string or boolean value to evaluate | |
*/ | |
public isDisabled(disabledValue: boolean | string) { | |
if (disabledValue === true || disabledValue === "true") { | |
return true; |
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
-- Eight queens solution in 5 lines of haskell | |
solution :: [Int] | |
solution = head (allSolutions !! 8) | |
allSolutions :: [[[Int]]] | |
allSolutions = iterate (concatMap extendSolution) [[]] | |
extendSolution :: [Int] -> [[Int]] | |
extendSolution qs = map (:qs) $ filter (`okToAdd` qs) [0..7] |
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
diff --git a/lib/guildship_web/resolvers/guilds.ex b/lib/guildship_web/resolvers/guilds.ex | |
index 92501df..7a0d34e 100644 | |
--- a/lib/guildship_web/resolvers/guilds.ex | |
+++ b/lib/guildship_web/resolvers/guilds.ex | |
@@ -1,11 +1,22 @@ | |
defmodule GuildshipWeb.Resolvers.Guilds do | |
- alias Guildship.Guilds | |
+ import Ecto.Query | |
+ alias Guildship.{Repo, Guilds} | |
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
open Belt; | |
[@bs.val] | |
external unsafeParseInt: (string, int) => Js.Null.t(float) = "parseInt"; | |
[@bs.val] [@bs.scope "Math"] external floor: float => int = "floor"; | |
type result('a, 'b) = | |
| Ok('a) | |
| Error('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
function randomDigitString(n) { | |
var x = n; | |
if (typeof n !== "number") x = 1; | |
if (n < 1) x = 1; | |
if (n > 19) x = 19; | |
return Math.random().toString().substr(2, x); | |
} |