Skip to content

Instantly share code, notes, and snippets.

@mizchi
mizchi / vite.config.js
Last active May 4, 2023 11:46
vite config with corp/coep header
import fs from "fs";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
{
name: "isolation",
configureServer(server) {
server.middlewares.use((_req, res, next) => {
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
@mykeels
mykeels / RsaKeyService.cs
Last active January 26, 2024 03:47
For IdentityServer4's AddSigningCredentials in production
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.IdentityModel.Tokens;
@rcy
rcy / apolloclient.js
Created May 18, 2017 23:51
apollo client setup for meteor
import { createMeteorNetworkInterface, meteorClientConfig } from 'meteor/apollo';
import { ApolloClient } from 'react-apollo';
import { SubscriptionClient, addGraphQLSubscriptions } from 'subscriptions-transport-ws';
const wsClient = new SubscriptionClient('ws://localhost:5000/', {
reconnect: true,
});
// Create a normal network interface:
@kjelloh
kjelloh / Resumable_Generator_T_Example.cpp
Last active December 28, 2017 00:03
A template<T> resumable generator example using co_yield in Visual Studio
// Resumable_Generator_T_Example.cpp
// Created by Kjell-Olov Högdahl
// This work is licensed under
// Creative Commons Attribution 4.0 International Public License
// https://creativecommons.org/licenses/by/4.0/
// This file available at gist https://gist.github.com/kjelloh/c8a61ad693242994f5dc26afbc6b174b
// Based on "CppCon 2016: James McNellis “Introduction to C++ Coroutines"" (https://youtu.be/ZTqHjjm86Bw?t=2390)
@ragingo
ragingo / location_api_sample.cpp
Created November 28, 2016 16:55
[C++] Windows 7 Location API サンプル (2011/06/05 01:09:00)
#include "stdafx.h"
namespace std
{
basic_ostream<TCHAR>& tcout =
#ifdef UNICODE
wcout;
#else

First of all, this is not my brilliant effort to get react-native working on Windows, it is the collation of work by others, particularly @mqli and @Bernd Wessels. I've just summarised what worked for me.

If you would prefer to read what I've plagerised, head over to mqli's great gist

Disclaimer

  • The below is tested with react-native-cli 0.1.5, react-native 0.12.0 on Windows 10, node 4.1.1, and Android (physical Nexus 6 and AVD with API v22)
  • I hope this will all be redundant in a few weeks. Please comment on stuff that is now fixed and I will update this to keep it relevant.
  • Sprinkle a bit of YMMV around

Keep this github issue handy, it’s the bucket for all Windows/Linux related tricks to get RN working.

@ruby0x1
ruby0x1 / main.cpp
Last active January 4, 2019 21:09
SDL2 sample
//SDL2 flashing random color example
//Should work on iOS/Android/Mac/Windows/Linux
#include <SDL.h>
#include <SDL_opengl.h>
#include <stdlib.h> //rand()
static bool quitting = false;
static float r = 0.0f;
@danharper
danharper / 1-sleep-es7.js
Created February 8, 2015 16:55
ES7's async/await syntax.
// ES7, async/await
function sleep(ms = 0) {
return new Promise(r => setTimeout(r, ms));
}
(async () => {
console.log('a');
await sleep(1000);
console.log('b');
})()
@terrancesnyder
terrancesnyder / node-0mq-ctrl-c.js
Created September 7, 2012 21:14
Handling Ctrl-C cleanly in Node.js
// Show how to handle Ctrl+C in Node.js
var zmq = require('zmq')
, socket = zmq.createSocket('rep');
socket.on('message', function(buf) {
// echo request back
socket.send(buf);
});
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",