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
/* | |
After jquery ui datepicker selection, blur and change | |
events fire before focus is returned to the input field, | |
handling a quirk from IE browsers | |
*/ | |
function setupDatepicker() { | |
// The 'isIE' var below requires an '.old-ie' class to be set on the html, | |
// for example: | |
// <!--[if lt IE 7]> <html class="old-ie lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
// <!--[if IE 7]> <html class="old-ie ie7 lt-ie9 lt-ie8"> <![endif]--> |
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 threading | |
import os | |
import sys | |
BLOCK_SIZE = 1024*1024 | |
THREADS = 16 | |
def write_range(source, target, start, amount, block_size): | |
with open(source, 'r') as source_file: | |
with open(target, 'r+') as target_file: |
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 hosts | xargs -P 0 -n1 -ihost bash -c 'ping -q -W 1 -c 1 host &> /dev/null || echo host failed' |
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
/* license: https://opensource.org/licenses/MIT */ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Interactivity; | |
namespace Behaviors { |
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 | |
set -eu | |
BRANCH_A="$1" | |
shift | |
BRANCH_B="$1" | |
shift | |
PATHS="$@" | |
BRANCH_A_COMMITS=$(mktemp) | |
ONLY_IN_BRANCH_A=$(mktemp) | |
BRANCH_B_COMMITS=$(mktemp) |
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 <stdint.h> | |
#include <stdio.h> | |
#include <pthread.h> | |
#include <stdlib.h> | |
#include <stdatomic.h> | |
#define CACHELINE__BYTECOUNT (64) | |
struct Data { | |
uint8_t bytes[CACHELINE__BYTECOUNT - 4]; |
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 | |
set -eu | |
# Similar to git branch --merged but looks at commit author, date and | |
# subject, instead of hash. | |
# | |
# Given branch/ref (e.g. my_branch) and target (e.g. origin/master), | |
# lists commits in branch that have no "equivalent" ones in target (by | |
# author, date and message). |
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
-- run it like: | |
-- stack ghc --package criterion -- binary.hs -Wall -O2 && ./binary | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE BangPatterns #-} | |
module Main where | |
import Data.ByteString.Lazy (ByteString) | |
import Data.Binary | |
import Data.Fixed |
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 -eu | |
LOG_FILE=$1 | |
SB="stdbuf -i0 -oL" | |
shift | |
tput sc | |
$@ 2>&1 | $SB tee $LOG_FILE | $SB cut -c-$(tput cols) | $SB sed -u 's/\(.\)/\\\1/g' | $SB xargs -0 -d'\n' -iyosi -n1 bash -c 'tput rc;tput el; printf "\r%s" yosi' | |
EXIT_CODE=${PIPESTATUS[0]} | |
tput rc;tput el;printf "\r" # Delete the last printed line | |
exit $EXIT_CODE |
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
interface IGetMethod { int GetValue(); } | |
interface ISetMethod { void SetValue(int value); } | |
interface IBothMethods : IGetMethod, ISetMethod { } | |
class BothMethods : IBothMethods | |
{ | |
int _value; |
NewerOlder