Skip to content

Instantly share code, notes, and snippets.

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

Sait Banazılı saitbnzl

🏠
Working from home
View GitHub Profile
@saitbnzl
saitbnzl / hex_to_ascii.dart
Created September 29, 2019 15:14
hex string to ascii string in dart
void main() {
String hexString =
"687474703A2F2F65727063727033752E706F61732E636F6D2E74723A383030302F4F415F48544D4C2F58787063417070536572766C65742E6A7370";
List<String> splitted = [];
for (int i = 0; i < hexString.length; i = i + 2) {
splitted.add(hexString.substring(i, i + 2));
}
String ascii = List.generate(splitted.length,
(i) => String.fromCharCode(int.parse(splitted[i], radix: 16))).join();
print('${ascii}');
@saitbnzl
saitbnzl / input_capitalizer.dart
Created August 29, 2019 11:16
Simple input capitalizer in Dart. You can use it inside InputFormatters in Flutter.
import 'package:flutter/services.dart';
import 'package:paynet/common/utils/index.dart';
class InputCapitalizer extends TextInputFormatter {
@override
TextEditingValue formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) {
int selectionIndex = newValue.selection.end;
return TextEditingValue(
@saitbnzl
saitbnzl / SmartWebView.js
Last active June 24, 2019 16:33
Auto height WebView for React Native
import {
Dimensions,
View,
WebView,
} from 'react-native';
import React, { Component } from 'react';
const injectedScript = function() {
function waitForBridge() {
if (window.postMessage.length !== 1){
@saitbnzl
saitbnzl / json_serializable_snippet.txt
Last active June 20, 2019 14:59
Flutter json_serializble snippet for intellij
import 'package:json_annotation/json_annotation.dart';
part '$FILE$.g.dart';
@JsonSerializable()
class $CLASS_NAME$ {
$CLASS_NAME$({});
factory $CLASS_NAME$.fromJson(Map<String, dynamic> json) =>
_$$$CLASS_NAME$FromJson(json);
Map<String, dynamic> toJson() => _$$$CLASS_NAME$ToJson(this);
@saitbnzl
saitbnzl / create_component.js
Last active January 12, 2019 16:20
Script to create react native component template
var mkdirp = require('mkdirp');
var path = require('path');
const fs = require('fs');
const args = process.argv.slice(2);
name = args[0];
const mainIndexContent = `\r\nexport {default as ${name}} from './${name}'`;
const indexContent = `import ${name} from './${name}'\r\nexport default ${name}`;
@saitbnzl
saitbnzl / SvgExperiments.js
Created January 5, 2019 22:32
Svg experiments with React Native
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import Svg, {
Defs,
LinearGradient,
Stop,
G,
Path,
Ellipse,
@saitbnzl
saitbnzl / PieChart.js
Created January 1, 2019 21:16
React Native Pie Chart
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import Svg, {
Defs,
LinearGradient,
Stop,
G,
Path,
Ellipse,
@saitbnzl
saitbnzl / turkey_cities.txt
Last active June 5, 2018 13:11
Türkiye Şehirleri Listesi (Alfabetik)
"Adana",
"Adıyaman",
"Afyonkarahisar",
"Ağrı",
"Aksaray",
"Amasya",
"Ankara",
"Antalya",
"Ardahan",
"Artvin",