This file contains 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
<?php | |
class DB | |
{ | |
protected static $connection; | |
public static function initialize($host, $username, $password, $name) | |
{ | |
if (!static::$connection) { |
This file contains 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 { Provider } from 'mobx-react/native'; | |
const SPECIAL_REACT_KEYS = { children: true, key: true, ref: true }; | |
export default class MobxRnnProvider extends Provider { | |
props: { | |
store: Object | |
}; | |
context: { |
This file contains 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
var rolesQuery = new Parse.Query(Parse.Role); | |
rolesQuery.equalTo('name', 'someRole'); | |
return rolesQuery.first({useMasterKey:true}) | |
.then(function(roleObject){ | |
var user = new Parse.User(); | |
user.id = req.params.userId; | |
roleObject.getUsers().add(user); | |
return roleObject.save(null, {useMasterKey:true}); | |
}); |
This file contains 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 'package:flutter/material.dart'; | |
class Bubble extends StatelessWidget { | |
Bubble({this.message, this.time, this.delivered, this.isMe}); | |
final String message, time; | |
final delivered, isMe; | |
@override | |
Widget build(BuildContext context) { |
This file contains 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
// Maximum depth is 3, after that we get a "" error from Parse | |
function getUserRoles(user) { | |
var queries = [ | |
new Parse.Query('_Role').equalTo('users', user) | |
]; | |
for (var i = 0; i < 2; i++) { | |
queries.push(new Parse.Query('_Role').matchesQuery('roles', queries[i])); | |
} | |
return user.rolesPromise = Parse.Query.or.apply(Parse.Query, queries).find().then( |
This file contains 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 Exceljs from "exceljs"; | |
import { groupBy, compact, isEmpty } from "lodash"; | |
const workbookFile = '/path/to/your/excelSheet/xlsx'; | |
const nameOfSheet = 'name of sheet in workbook'; | |
let workbook = new Exceljs.Workbook(); | |
await workbook.xlsx.readFile(workbookFile); | |
const sheet = workbook.getWorksheet(nameOfSheet); |
This file contains 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
<?php | |
$db_con = mysqli_connect("localhost", "username", "password", "database"); | |
$result = $db_con->query('SELECT * FROM some_table'); | |
if (!$result) die('Couldn\'t fetch records'); | |
$num_fields = mysqli_num_fields($result); | |
$headers = array(); | |
while ($fieldinfo = mysqli_fetch_field($result)) { | |
$headers[] = $fieldinfo->name; | |
} | |
$fp = fopen('php://output', 'w'); |
This file contains 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
# HTTP - redirect all requests to HTTPS | |
server { | |
listen 80; | |
listen [::]:80 default_server ipv6only=on; | |
return 301 https://$host$request_uri; | |
} | |
# HTTPS - serve HTML from /usr/share/nginx/html, proxy requests to /parse/ | |
# through to Parse Server | |
server { |
This file contains 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 'package:advert_app/utils/logging.dart'; | |
import 'package:flutter/widgets.dart'; | |
import 'package:flutter/gestures.dart'; | |
class ScalingGestureDetector extends StatefulWidget { | |
final Widget child; | |
final void Function(Offset initialPoint) onPanStart; | |
final void Function(Offset initialPoint, Offset delta) onPanUpdate; | |
final void Function() onPanEnd; |
OlderNewer