Skip to content

Instantly share code, notes, and snippets.

View Sadmansamee's full-sized avatar
🤖
Focusing

Sadman Samee Sadmansamee

🤖
Focusing
View GitHub Profile
@Sadmansamee
Sadmansamee / flutter_starter.md
Last active February 9, 2023 03:44
Flutter Starter Kits
@Sadmansamee
Sadmansamee / default.nginx
Last active June 7, 2019 14:19 — forked from movibe/default.nginx
Parse Server Nginx default
# 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 {
@Sadmansamee
Sadmansamee / countries.json
Created October 18, 2018 14:13 — forked from lognaso/countries.json
Countries - name, dial_code, code
[
{
"name": "Afghanistan",
"dial_code": "+93",
"code": "AF"
},
{
"name": "Aland Islands",
"dial_code": "+358",
"code": "AX"
@Sadmansamee
Sadmansamee / react_native_clear.md
Last active October 1, 2018 16:16
React Native clear cache
  1. rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && npm cache clean --force && npm cache verify && rm -rf ios/build && rm -rf node_modules/ && npm i
  2. watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro* && rm -rf $TMPDIR/haste
  3. rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean --force && npm i
  4. watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
  5. watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
@Sadmansamee
Sadmansamee / Count lines of code in Xcode project
Last active October 24, 2017 21:01
Count lines of code in Xcode project
1. Open Terminal
2. cd to your Xcode project
3. Execute any following command:
a) Including Pods: find . -name "*.swift" -print0 | xargs -0 wc -l
b) Excluding Pods: find . -path ./Pods -prune -o -name "*.swift" -print0 ! -name "/Pods" | xargs -0 wc -l
c) Swift and Obj-C: find . -type d \( -path ./Pods -o -path ./Vendor \) -prune -o \( -iname \*.m -o -iname \*.mm -o -iname \*.h -o -iname \*.swift \) -print0 | xargs -0 wc -l
Alternative way
# brew install cloc
@Sadmansamee
Sadmansamee / NilIfEmpty.swift
Created September 19, 2017 13:01
It's not null but is it empty?
extension Optional where Wrapped == String {
var nilIfEmpty: String? {
guard let strongSelf = self else {
return nil
}
return strongSelf.isEmpty ? nil : strongSelf
}
}//USAGE
//guard let title = textField.text.nilIfEmpty else {
// // Alert: textField is empty!
import android.text.TextUtils;
import io.realm.Case;
import io.realm.Realm;
import io.realm.RealmObject;
import io.realm.RealmResults;
public class RealmFullTextSearch {
public static <T extends RealmObject> RealmResults<T> search(Realm realm, Class<T> modelClass, String query, String fieldName, boolean partialSearch){
@Sadmansamee
Sadmansamee / StringExtensionHTML.swift
Created February 5, 2016 08:45
Decoding HTML Entities in Swift
//
// Extension.swift
// Hadith
//
// Created by Sadman samee on 2/5/16.
// Copyright © 2016 LoopsLab. All rights reserved.
//
import Foundation
import Foundation
@Sadmansamee
Sadmansamee / CalculatorOp
Created October 1, 2012 15:06
simple calculator for begginer
public class CalculatorOp {
private int total;
public CalculatorOp()
{
total=0;
}
public String GetTotalString()
{return ""+total;
}
public void setTotal(String n)