Skip to content

Instantly share code, notes, and snippets.

@homanp
homanp / gist:4e49daedddabfa5b8321
Last active February 13, 2018 23:51
Nginx Html5Mode for ReactJS
server {
listen 80;
server_name react.dev;
root /app/react-demo;
location / {
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
}
}
componentDidMount: fucntion() {
// tracking code here
},
class BillingCard(generics.UpdateAPIView):
permission_classes = (IsAuthenticated,)
def post(self, request):
cc_token = request.DATA.get('cc_token', None)
if cc_token:
company = helpers.create_customer(self, cc_token)
serializer = CompanySerializer(company)
return Response(serializer.data, status=status.HTTP_200_OK)
else:
import settings
from core.models import Company
import stripe
def create_customer(instance, token):
stripe.api_key = settings.STRIPE_SECRET_KEY
customer_name = instance.request.user.userprofile.company.name
@homanp
homanp / RCTSound.h
Last active June 15, 2016 07:20
RCTSound.h
#import "RCTBridgeModule.h"
@interface RCTSound : NSObject <RCTBridgeModule>
@end
@homanp
homanp / RCTSound.m
Last active June 15, 2016 07:21
Implementation file
#import "RCTSound.h"
#import <AVFoundation/AVPlayer.h>
#import <AVFoundation/AVPlayerItem.h>
#import <AVFoundation/AVAsset.h>
#import "RCTEventDispatcher.h"
@implementation RCTSound {
NSString *audioUrl;
AVPlayerItem *player;
AVPlayer *stream;
let contacts = [];
_.filter(phoneContacts, (contact) => {
_.filter(contact.phoneNumbers, (number) => {
if (number.digits.indexOf(searchString) > -1 || contact.fullName.indexOf(searchString) > -1) {
let mutableContact = _.clone(contact);
contacts.push(mutableContact);
}
});
});
return contacts;
package com.bitcallproject.RNPlivo;
import com.bitcallproject.MainActivity;
import com.bitcallproject.RNPlivo.ServiceCallbacks;
import java.lang.Exception;
import java.lang.Error;
import java.util.Timer;
import java.util.TimerTask;
function start_wp_head_buffer() {
ob_start();
}
add_action('wp_head','start_wp_head_buffer',0);
function end_wp_head_buffer() {
$in = ob_get_clean();
echo $in; // output to head-tag
}
add_action('wp_head','end_wp_head_buffer', PHP_INT_MAX);
<table class="specificationTable">
<tbody>
<tr>
<td></td>
<td class="specificationLabel">
<div class="landscapeIcon"></div>
<p>A5 {{translate key="Hoch"}}</p>
</td>
<td class="specificationLabel">
<div class="landscapeIcon"></div>