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
chrome.extension.onRequest.addListener( | |
function(request, sender, sendResponse) { | |
console.log(sender.tab ? | |
"from a content script:" + sender.tab.url : | |
"from the extension"); | |
if (request.greeting == "hello") | |
sendResponse({farewell: "goodbye"}); | |
else | |
sendResponse({}); // snub them. | |
}); |
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 static org.junit.Assert.assertEquals; | |
import java.io.BufferedReader; | |
import java.io.StringReader; | |
import java.util.Collection; | |
import org.junit.Test; | |
import com.google.gson.Gson; | |
import com.google.gson.GsonBuilder; |
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
use std::util; | |
struct Bar; | |
struct Foo { | |
test: bool, | |
count: int, | |
bar: Bar, | |
} | |
impl Foo { |
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
struct Foo { | |
bar: ~Bar | |
// ^~~ error: Illegal anonymous lifetime: anonymous lifetimes are not permitted here | |
} | |
struct Bar<'self> { | |
owner: &'self Foo | |
// ^~~ error: Illegal anonymous lifetime: anonymous lifetimes are not permitted here | |
} | |
// Note that if Bar has _any_ borrowed reference (not just to a Foo), |
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> | |
#import <IOBluetooth/IOBluetooth.h> | |
enum HandlerState { | |
HandlerStateStarting, | |
HandlerStateWaitingForServiceToAdd, | |
HandlerStateWaitingForAdvertisingToStart, | |
HandlerStateAdvertising, | |
HandlerStateError, | |
}; |
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
Bus 004 Device 043: ID 1cfb:1010 | |
Device Descriptor: | |
bLength 18 | |
bDescriptorType 1 | |
bcdUSB 2.00 | |
bDeviceClass 2 Communications | |
bDeviceSubClass 0 | |
bDeviceProtocol 0 | |
bMaxPacketSize0 16 |
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
// clang -framework PCSC scardstatus_bug.c -o scardstatus_bug | |
// Tests SCardStatus bug in OSX 10.10 Yosemite. | |
// Connects to a smart card and calls SCardStatus. | |
#include <stdio.h> | |
#include <strings.h> | |
#include <stdlib.h> | |
#include <PCSC/wintypes.h> | |
#include <PCSC/winscard.h> | |
#define TEXT(x) x |
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
//! cl.exe /Tp listviwe_setselectionmark.cpp User32.lib ComCtl32.lib Ole32.lib | |
#define STRICT | |
#define UNICODE | |
#define _UNICODE | |
#include <windows.h> | |
#include <windowsx.h> | |
#include <ole2.h> | |
#include <commctrl.h> | |
#include <shlwapi.h> | |
#include <shlobj.h> |
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
//! cl.exe /EHsc /Tp treeview-and-tabcontrol.cpp User32.lib ComCtl32.lib Ole32.lib | |
// Based on Raymond Chen's scratch program | |
// http://blogs.msdn.com/b/oldnewthing/archive/2005/04/22/410773.aspx | |
#define STRICT | |
#define UNICODE | |
#define _UNICODE | |
#include <windows.h> | |
#include <windowsx.h> | |
#include <ole2.h> | |
#include <commctrl.h> |
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
#!/usr/bin/env bash | |
# Convert a directory to a ConfigMap json file as when doing kubectl create configmap --from-file … | |
# | |
# Example usage: | |
# 1. kubectl create cm test-cm --from-file path/to/cmdir | |
# | |
# 2. Before running kubectl replace, you should diff the directories: | |
# dirToCm test-cm path/to/cmdir | cmToDir /tmp/test-cm-new | |
# kubectl get cm test-cm -o json | cmToDir /tmp/test-cm-orig |
OlderNewer