Skip to content

Instantly share code, notes, and snippets.

View jdmunro's full-sized avatar

James Munro jdmunro

View GitHub Profile
@jdmunro
jdmunro / gist:5e9abdef4b48f18679c5
Created October 28, 2014 14:58
Scanning for Bluetooth devices
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
bluetoothAdapter.startDiscovery();
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(bluetoothReceiver, filter);
private final BroadcastReceiver bluetoothReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
@jdmunro
jdmunro / gist:27521
Created November 21, 2008 17:58
Strips certain HTML tags out of a buffer
void stripHtmlTag( char* htmlBuffer, char* openTag, char* closeTag )
{
char tmpBuffer[HTTP_RESPONSE_SIZE] = "";
char* start = NULL;
char* end = NULL;
char* p = NULL;
int bytes = -1;
p = htmlBuffer;
# lighttpd configuration file
#
# use it as a base for lighttpd 1.0.0 and above
#
# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $
############ Options you really have to take care of ####################
## modules to load
# at least mod_access and mod_accesslog should be loaded
diff --git a/code/client/snd_local.h b/code/client/snd_local.h
index 86c7d4a..62b998f 100644
--- a/code/client/snd_local.h
+++ b/code/client/snd_local.h
@@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"
#include "snd_public.h"
+#include <SDL_thread.h>
Output of locale-gen:
Generating locales...
en_GB.UTF-8... done
en_GB.ISO-8859-1... done
Generation complete.
Output of 'locale':
LANG=en_US.UTF-8
[james@odyssey:~]$ sudo pacman -Syu (01-14 17:14)
:: Synchronising package databases...
core is up to date
error: segmentation fault 10.0K 0.3K/s 00:18:33 [---------------------] 2%
Internal pacman error: Segmentation fault.
Please submit a full bug report with --debug if appropriate.
[james@odyssey:~]$ pacman --version (01-14 17:14)
.--. Pacman v3.2.2 - libalpm v3.1.1
public MemoryStream GetFileStream( string sFile )
{
if( !this.Exists(sFile) ) {
System.Console.WriteLine("Error loading non-existent file (GetFileStream)");
return null;
}
// Load the file from the search path.
IntPtr fh = IntPtr.Zero;
if( ( fh = Fs.PHYSFS_openRead(sFile) ) == IntPtr.Zero ) {
--- teeworlds-0.5.1-src/src/game/client/components/hud.cpp
+++ teeworlds/teeworlds-0.5.1-src/src/game/client/components/hud.cpp
@@ -18,7 +18,12 @@
HUD::HUD()
{
-
+ // OR: memset(&fps_samples,0.0f,MAX_FPS_SAMPLES);
+ for(int i = 0; i < MAX_FPS_SAMPLES; i++)
+ fps_samples[i] = 0.0f;
it('does not repeat meals within the same week if enough meals are available', () => {
const mealIds = ['1', '2', '3', '4', '5', '6', '7'];
const meals = immutable.fromJS({
[mealIds[0]]: {name: 'Spaghetti'},
[mealIds[1]]: {name: 'Fish and Chips'},
[mealIds[2]]: {name: 'Meat and Potato Pie'},
[mealIds[3]]: {name: 'Lasagne'},
[mealIds[4]]: {name: 'Fish Stew'},
[mealIds[5]]: {name: 'Toad in the Hole'},
[mealIds[6]]: {name: 'Pork Cutlets'},
describe('Meal Plan List', () => {
it('renders correctly', () => {
const week = immutable.Map({
week: 4,
year: 2017,
});
store.dispatch(importMeals(SAMPLE_MEALS));
store.dispatch(setVisibleWeek(week));