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
func qsort(a []int) []int { | |
if len(a) < 2 { return a } | |
left, right := 0, len(a) - 1 | |
// Pick a pivot | |
pivotIndex := rand.Int() % len(a) | |
// Move the pivot to the right | |
a[pivotIndex], a[right] = a[right], a[pivotIndex] |
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
#pragma mark - CLLocationManagerDelegate | |
- (void)locationManager:(CLLocationManager *)manager | |
didUpdateLocations:(NSArray *)locations | |
{ | |
[manager stopUpdatingLocation]; | |
DLog(@"location %@", locations); | |
CLGeocoder *geocoder = [[CLGeocoder alloc] init]; | |
[geocoder reverseGeocodeLocation:locations[0] completionHandler:^(NSArray *placemarks, NSError *error) { | |
CLPlacemark *placemark = placemarks[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
#include <stdio.h> | |
#define N 1000 | |
void initialize(long long int *r, long long int *s, long long int *y, long long int *x); | |
int | |
main(int argc, char* argv[]) | |
{ | |
// z: k + 1 |
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
static inline int | |
ud_floor(const double x) | |
{ | |
return (x > 0 ? (int)x : (int)x - 1); | |
} |
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
alias blp='bl | peco | chbarg' | |
function chbarg() | |
{ | |
target=`awk '{print $1}' | sed -e 's/^remotes\///'` | |
branch=`echo $target | awk '{sub("/", "-"); print $0;}'` | |
git checkout -b $branch $target | |
if [[ $? != 0 ]]; then | |
git checkout $branch | |
fi | |
} |
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
cat strings.xml | awk '{sub(".*string.*\">", "");print $1}' | awk '{sub("<\/string.*","");print $1}' | awk '{sub("^<.*", ""); print $1}' |
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
#!/bin/bash | |
# File: ex.sh | |
# Maintainer: Shintaro Kaneko <kaneshin0120@gmail.com> | |
# Last Change: 06-Aug-2014. | |
# Usage: | |
# bash ex.sh strings.xml strings_foo.xml strings_bar.xml strings_baz.xml strings_qux.xml > result.csv | |
list=$@ | |
for var in $list |
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
$content = ' | |
<Font Size="0" Color="#000000"><div style="line-height:0">########## | |
新着情報</div></Font> | |
入力項目1 | |
<Font Size="0" Color="#000000">##########</Font> | |
<Font Size="0" Color="#000000"><div style="line-height:0">########## | |
新#着情報</div></Font> | |
入力項目2 | |
<Font Size="0" Color="#000000">##########</Font> |
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
/** | |
* Foo | |
*/ | |
public class Foo { | |
private static final int MIN_HEIGHT = 130; | |
private static final int MAX_HEIGHT = 200; | |
private static final int[] EXPECTED = { | |
130, | |
135, |
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
extension SLComposeViewController { | |
convenience init(forServiceType type: String, initialText text: String) { | |
self.init(forServiceType: type) | |
self.setInitialText(text) | |
} | |
class func shareViewController(forServiceType type: String) -> SLComposeViewController { | |
let text = LocalizedString("Share body") | |
let viewController = SLComposeViewController(forServiceType: type, initialText: text) | |
viewController.completionHandler = { (result) in |
OlderNewer