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
#include "bits.h" | |
const int NUM_BITS_IN_BYTE = 8; | |
int getbit(char c, int i) { | |
if (i >= NUM_BITS_IN_BYTE || i < 0) { | |
return -1; | |
} | |
return (c & (1 << i)) > 0; | |
} |
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
package main | |
import ( | |
"encoding/json" | |
"log" | |
"net/http" | |
) | |
type Comment struct { | |
Author string `json:"author"` |
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
package main | |
import ( | |
"flag" | |
"io" | |
"log" | |
"os" | |
"golang.org/x/net/websocket" | |
) |
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
package main | |
import ( | |
"bufio" | |
"container/list" | |
"flag" | |
"io" | |
"log" | |
"net/http" | |
"os" |
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
// | |
// ColorListGenerator.m | |
// | |
@import AppKit; | |
NSColor *colorFromRGB(unsigned rgbValue) { | |
CGFloat r = (CGFloat)((rgbValue & 0xFF0000) >> 16); | |
CGFloat g = (CGFloat)((rgbValue & 0x00FF00) >> 8); | |
CGFloat b = (CGFloat)(rgbValue & 0x0000FF); |
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 ObjectiveC; | |
@interface MyClass : NSObject | |
@end | |
@implementation MyClass | |
+ (void)methodA { | |
Method mb = class_getClassMethod([self class], @selector(methodB:)); |
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
var url = require('url'); | |
var Crawler = require('crawler'); | |
var moment = require('moment'); | |
var _ = require('underscore'); | |
var c = new Crawler({ | |
maxConnections: 20 | |
}); |
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
curl -s http://www.readmanga.today/naruto/700.2/all-pages | pup '.img-responsive-2 attr{src}' | xargs -n 1 curl -sO; convert * cartoon.pdf |
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
#include <stdio.h> | |
#include <string.h> | |
void printBits(char *bits, size_t n) { | |
for (int i = 0; i < n; ++i) { | |
printf("%c", (bits[i/8] & (1 << (7 - i%8))) == 0 ? '0' : '1'); | |
} | |
printf("\n"); | |
} |
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
// https://arena.topcoder.com/#/u/practiceCode/10882/7034/7850/1/265822 | |
#include <map> | |
#include <vector> | |
using namespace std; | |
struct BestHotel { | |
int numberOfDisadvantageous(vector<int> price, vector<int> quality) { | |
map<int, int> bestHotels; |