Skip to content

Instantly share code, notes, and snippets.

View indatawetrust's full-sized avatar
🏠
Working from home

Ahmet Şimşek‎ indatawetrust

🏠
Working from home
View GitHub Profile
const authPassportJWT = (req, res, next) => {
passport.authenticate('jwt', {session: false}, (err, user, info) => {
if (err || !user) {
res.status(401).json({
ok: false
})
} else if (!err && user) {
req.user = user
void main() {
String str = "\"property_map_location\": [ \"a:2 {s:8:\"latitude\";s:9:\"13.143044\";s:9:\"longitude\";s:10:\"-61.165210\";}\" ]";
RegExp exp = new RegExp(r's:[0-9]{1,}:"([-0-9.]+)";');
Iterable<Match> matches = exp.allMatches(str);
matches.toList().forEach((item) {
print(double.parse(item[1]));
canvas.on('object:moving', e => {
e.target.lockMovementX = true
e.target.lockMovementY = true
})
canvas.on('object:scaling', e => {
e.target.lockScalingX = true
e.target.lockScalingY = true
e.target.lockUniScaling = true
})
void main() {
String str = "a:10:{i:1520;s:68:\"https://www.caribidreams.com/wp-content/uploads/2018/01/IMG_9764.jpg\";i:1519;s:68:\"https://www.caribidreams.com/wp-content/uploads/2018/01/IMG_9763.jpg\";i:1532;s:68:\"https://www.caribidreams.com/wp-content/uploads/2018/01/IMG_9880.jpg\";i:1528;s:68:\"https://www.caribidreams.com/wp-content/uploads/2018/01/IMG_9876.jpg\";i:1521;s:68:\"https://www.caribidreams.com/wp-content/uploads/2018/01/IMG_9767.jpg\";i:1522;s:68:\"https://www.caribidreams.com/wp-content/uploads/2018/01/IMG_9769.jpg\";i:1525;s:68:\"https://www.caribidreams.com/wp-content/uploads/2018/01/IMG_9773.jpg\";i:1523;s:68:\"https://www.caribidreams.com/wp-content/uploads/2018/01/IMG_9770.jpg\";i:1527;s:68:\"https://www.caribidreams.com/wp-content/uploads/2018/01/IMG_9875.jpg\";i:1526;s:68:\"https://www.caribidreams.com/wp-content/uploads/2018/01/IMG_9775.jpg\";}";
RegExp exp = new RegExp(r"(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|gif|png)");
Iterable<Match> matches = exp.allMatches(str);
mat
@indatawetrust
indatawetrust / iframe.html
Last active July 5, 2018 12:26
iframe communication
<html>
<head>
<script>
var library = (function() {
function bindEvent(element, eventName, eventHandler) {
if (element.addEventListener){
element.addEventListener(eventName, eventHandler, false);
} else if (element.attachEvent) {
@indatawetrust
indatawetrust / headernamewidget.dart
Created May 25, 2018 18:52
widget usage with parameter
class HeaderNameWidget extends StatefulWidget {
HeaderNameWidget({Key key, this.name}) : super(key: key);
final String name;
@override
_HeaderNameState createState() => new _HeaderNameState();
}
class _HeaderNameState extends State<HeaderNameWidget> {
/**--------------------------------------------------------------------------------
*
* Copyright (c) 2016, Samsung Electronics Co., Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@indatawetrust
indatawetrust / client.js
Last active April 3, 2018 14:08
Lightstreamer web client
/*
* LIGHTSTREAMER - www.lightstreamer.com
* Lightstreamer Web Client
* Version 7.1.2 build 1749
* Copyright (c) Lightstreamer Srl. All Rights Reserved.
* Contains: LightstreamerClient, Subscription, StaticGrid, Promise
* Globals
*/
(function(){function define(a,c,e){define.a[a]={e:c,d:e}}define.a={};define.b=function(a,c,e){for(var g=[],f=0;f<a.length;f++){var d=define.a[a[f]];if(!d)throw"All the modules must already be 'defined' Async load not supported: use a full-featured AMD loader like requirejs";d.c||define.b(d.e,d.d,a[f]);g.push(d.c)}a=c.apply(null,g);if(e)define.a[e].c=a};function require(a,c){define.b(a,c,null)};define("IllegalStateException",[],function(){function e(e){this.name="IllegalStateException";this.message=e}e.prototype={toString:function(){return["[",this.name,this.message,"]"].join("|")}};return e});
define("Environment",["IllegalStateException"],function(e){var g="undefined"!==typeof window&&"undefined"!==typeof navigator&&"undefined"!==typeof document,c="undefined"!==typeof impo
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<title>Application Error</title>
<style media="screen">
html,body,iframe {
margin: 0;
padding: 0;
}
html,body {
<script>
console.log(window.parent.window.location.href)
</script>