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
au BufWinEnter COMMIT_EDITMSG setlocal tw=75 | |
au BufWinEnter COMMIT_EDITMSG let w:g1=matchadd('ErrorMsg', '\%1l\%51v.\+', -1) | |
au BufWinEnter COMMIT_EDITMSG let w:g2=matchadd('ErrorMsg', '\%76v.\+', -1) | |
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%80v.\+', -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/sh -e | |
separator="----8<----8<----8<----8<----" | |
function make_chunk { | |
cd $1 | |
if ! git diff --exit-code --ignore-submodules --quiet; then | |
echo "${PWD#$root}/" | |
git --no-pager diff --no-color --ignore-submodules | |
echo "$separator" |
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
// The MIT License (MIT) | |
// Copyright (c) 2015 tomykaira | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON |
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 pp () { | |
export PREVIOUS_PP_ARGS="$*" | |
pgrep -lfa $* | |
} | |
function pk () { | |
if [ $# -eq 0 ]; then | |
pgrep -lf $PREVIOUS_PP_ARGS | awk '{print $1}' | xargs kill | |
else | |
pgrep -lf $PREVIOUS_PP_ARGS | sed "$1q;d" | awk '{print $1}' | xargs kill |
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
package com.example.android; | |
import org.junit.runners.model.InitializationError; | |
import org.robolectric.AndroidManifest; | |
import org.robolectric.RobolectricTestRunner; | |
import org.robolectric.res.DrawableNode; | |
import org.robolectric.res.OverlayResourceLoader; | |
import org.robolectric.res.PackageResourceLoader; | |
import org.robolectric.res.ResName; | |
import org.robolectric.res.ResourceLoader; |
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
<?php | |
require 'vendor/autoload.php'; | |
use Guzzle\Service\Client; | |
// Create a client with a base URL | |
$client = new Client('http://requestb.in/1ivmkhd1'); | |
$client->setUserAgent('myuseragent'); | |
// Send a request to https://github.com/notifications | |
$response = $client->get('')->send(); |
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
times = 1000000; | |
console.time('global'); | |
for (i = 0; i < times; ++i) { | |
// do something | |
} | |
console.timeEnd('global'); |
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
import time | |
import itertools | |
import gc | |
gc.disable() | |
start = time.time() | |
for i in itertools.repeat(None, 10000): | |
# do something |
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
class Bean { | |
@JsonDeserialize(using=RrDeserializer.class) | |
public final Object rr; | |
public static class RrDeserializer extends JsonDeserializer<Object> implements ResolvableDeserializer { | |
JsonDeserializer<Object> sampleRefResponseDeserializer; | |
@Override | |
public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { | |
JsonToken token = jp.getCurrentToken(); |
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 <chrono> | |
#include <iostream> | |
auto start = std::chrono::high_resolution_clock::now(); | |
// do something | |
auto end = std::chrono::high_resolution_clock::now(); | |
std::cout << std::chrono::duration_cast<std::chrono::microseconds>(end - start).count() << std::endl; |