Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mikesurowiec's full-sized avatar
🌀

Mike Surowiec mikesurowiec

🌀
View GitHub Profile
// AudioManager.m
#import "RCTBridgeModule.h"
// This registers your module with React Native, so it can be exposed to JS
@interface RCT_EXTERN_MODULE(AudioManager, NSObject)
RCT_EXTERN_METHOD(setPlaying:(BOOL) value
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject
@mikesurowiec
mikesurowiec / ProjectName-Bridging-Header.h
Last active February 25, 2017 04:45
React Native Swift & Promises
//ProjectName-Bridging-Header.h
#import "RCTBridgeModule.h"
#import "RCTEventDispatcher.h"
#import "RCTEventEmitter.h"
@mikesurowiec
mikesurowiec / AudioComponent.js
Created February 25, 2017 04:39
React Native Swift & Promises
import {
NativeModules,
} from 'react-native';
const { AudioManager } = NativeModules;
async function setPlaying (shouldPlay: boolean) => {
const isPlayingNativeResult = await AudioManager.setPlaying(shouldPlay);
// do something with the native result
}

Keybase proof

I hereby claim:

  • I am mikesurowiec on github.
  • I am mikesurowiec (https://keybase.io/mikesurowiec) on keybase.
  • I have a public key whose fingerprint is 2755 2A79 877E A153 DE98 591D 148D 30EF 1F3A B5A2

To claim this, I am signing this object:

@mikesurowiec
mikesurowiec / gist:4177193
Created November 30, 2012 17:30
from ejs array of objects to js array
<script>
var resultsArr = [];
<% for (var i=0, len=results.length; i<len; i++) { %>
resultsArr.push(<%- results[i] %>);
<% } %>
</script>
error git clone git@github.com:Lulo/node-onswipe.git Permission denied (publickey).
error git clone git@github.com:Lulo/node-onswipe.git fatal: The remote end hung up unexpectedly
silly lockFile d9e3d72b-github-com-Lulo-node-onswipe-git git@github.com:Lulo/node-onswipe.git
error Error: `git "clone" "git@github.com:Lulo/node-onswipe.git" "/Users/mikesurowiec/tmp/npm-73515/1353184950023-0.525405049091205"` failed with 128
@mikesurowiec
mikesurowiec / maybe_on.js
Created October 11, 2012 11:53 — forked from frankpinto/maybe_on.js
Conditional Synapse Embed
<script type="text/javascript">
var onswipeSometimes = function() {
var usr = "f";
var numToRedirect = 0.75; // percent of people to redirect
var randomNumber = Math.random(); // [0, 1)
if (randomNumber <= numToRedirect) {
var synapse = 'http://assets.onswipe.com/synapse/on.js?usr=' + usr;
var embed = document.createElement('script');
embed.setAttribute('type', 'text/javascript');
embed.setAttribute('id', 'onswipe_synapse');