Skip to content

Instantly share code, notes, and snippets.

@guftall
guftall / checkConnType.java
Last active December 11, 2017 18:38
Android - network working
// this code obtained from telegram android source /DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java
public static boolean isConnectedOrConnectingToWiFi() {
try {
ConnectivityManager connectivityManager = (ConnectivityManager) ApplicationLoader.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
NetworkInfo.State state = netInfo.getState();
if (netInfo != null && (state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING || state == NetworkInfo.State.SUSPENDED)) {
return true;
}
@guftall
guftall / font.css
Created December 25, 2017 03:05
pretty persion font from zarinpal.com
@font-face { font-family: "IRANSansLightPersian"; font-style: normal; font-weight: 300; src: url("https://cdn.zarinpal.com/panel/v1/assets/fonts/sansLight.ttf?1f20916062d2a26389128449c4823825") format("truetype"); }
@font-face { font-family: "IRANSans"; font-style: normal; font-weight: 400; src: url("../fonts/IRANSansWeb.eot?e43cfbc1a67d90e910398ded8345cd32?#iefix") format("embedded-opentype"), url("https://cdn.zarinpal.com/panel/v1/assets/fonts/IRANSansWeb.woff2?c6f46673e2449eb071e2c098c5190c2a") format("woff2"), url("../fonts/IRANSansWeb.woff?df14582918ca379a280e453bb3cc6ba5") format("woff"), url("../fonts/IRANSansWeb.ttf?ac22d187130d6c3433a49a1e98bfa968") format("truetype"); }
@font-face { font-family: "ZarinPal"; font-style: normal; font-weight: 400; src: url("../fonts/ZarinPal.eot?a2cd02a915f5451361b60d42f3a81699") format("embedded-opentype"), url("https://cdn.zarinpal.com/panel/v1/assets/fonts/ZarinPal.ttf?c943da56c7301271b3a24b2ebfff9192") format("truetype"), url("../fonts/ZarinPal.woff?ecfa2ca1e5c51
ex = a8061e580c461c9285c52f5f396e3a04790094c2dcae4b43a46cf734a096338f
no = 9f70bbadb490db58b7caedff303e00dffd4ca8dc85cc54148a37cf68b83173a3
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
package manager;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@guftall
guftall / tips.ts
Created April 6, 2019 16:13
angular tips
/* angular version: "^6.1.0" */
/* navigate to child route from component method */
this.router.navigate(['/Dashboard', {outlets: { menu_Dashboard: 'Increase-Credit'}}]);
/* from html file(dashboard-component.html) that DashboardComponent rendered
* [routerLink]="[{outlets:{menu_Dashboard:['Increase-Credit']}}]"
* */
const routes: Routes = [
@guftall
guftall / tips.ts
Created April 6, 2019 16:18
angular tips
/* angular version: "^6.1.0" */
/* navigate to child route from component method */
this.router.navigate(['/Dashboard', {outlets: { menu_Dashboard: 'Increase-Credit'}}]);
/* from html file(dashboard-component.html) that DashboardComponent rendered
* [routerLink]="[{outlets:{menu_Dashboard:['Increase-Credit']}}]"
* */
const routes: Routes = [
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA localhost. root.localhost. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
@guftall
guftall / Dockerfile
Created May 14, 2019 08:56
docker file for aspnetcore angular spa
FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /app
COPY server.sln .
COPY ./Server/Server.csproj ./Server/
COPY ./Logger/Logger.csproj ./Logger/
COPY ./Server ./Server/
COPY ./Logger/. ./Logger/
@guftall
guftall / iran-study-fields.json
Last active February 13, 2023 21:42
Iran universities and study fields
{
"riazi": [
"مهندسی برق",
"مهندسی کامپیوتر",
"مهندسی مکانیک",
"مهندسی عمران",
"مهندسی معماری",
"مهندسی کشتی",
"مهندسی هوافضا",
"مهندسی انرژی",