This file contains hidden or 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
const search = (array, target) => { | |
for (var i = 0; i < array.length; ++i) { | |
if (array[i] == target) { return i } | |
} | |
return -1 | |
} | |
var numbers = [ 1, 3, 6, 13, 21 ] | |
console.log(search(numbers, 13)) // 3 |
This file contains hidden or 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
using System; | |
class Program | |
{ | |
static void Main() | |
{ | |
Func<int, Func<int, int>> curriedSum = lhs => rhs => lhs + rhs; // currying | |
Console.WriteLine(curriedSum(1)(2)); // 3 | |
Console.WriteLine(curriedSum(4)(5)); // 9 |
This file contains hidden or 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
using System; | |
class Program | |
{ | |
static void Main() | |
{ | |
Func<int, int, int> sum = (lhs, rhs) => lhs + rhs; | |
Console.WriteLine(sum(1, 2)); // 3 | |
Console.WriteLine(sum(4, 5)); // 9 |
This file contains hidden or 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
#!/bin/sh -x | |
#This script removes Mono from an OS X System. It must be run as root | |
rm -r /Library/Frameworks/Mono.framework | |
rm -r /Library/Receipts/MonoFramework-* | |
for dir in /usr/bin /usr/share/man/man1 /usr/share/man/man3 /usr/share/man/man5; do | |
(cd ${dir}; |
This file contains hidden or 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
(add-to-list 'load-path "~/.emacs.d/vendor/github/markdown-mode") | |
(autoload 'markdown-mode "markdown-mode.el" "Major mode for editing Markdown files" t) | |
(setq auto-mode-alist (cons '("\\.text" . markdown-mode) auto-mode-alist)) |
This file contains hidden or 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
## -*- encoding: utf-8 -*- | |
## | |
## example configuration (version >= 1.2) | |
## | |
## if undefine LogDir, Debug mode is forcefully enabled. | |
LogDir: logs/ | |
Debug: false | |
Daemon: false | |
## API Key can be defined up to 5-keys with comma separated values. |
This file contains hidden or 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
#import <Foundation/Foundation.h> | |
@class MyClass; | |
@interface Composited : NSObject { | |
__weak MyClass *myClass_; | |
} | |
- (id)initWithMyClass:(MyClass *)myClass; | |
- (void)func; | |
@end |