Skip to content

Instantly share code, notes, and snippets.

View deremakif's full-sized avatar

Mehmet Akif DERE deremakif

View GitHub Profile
@deremakif
deremakif / apns.sh
Created June 1, 2022 10:13 — forked from greencoder/apns.sh
Curl the APNS http/2 API
# Note: You MUST have curl 7.47+ with http/2 support compiled in
curl -v \
-d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-topic: <bundle id>" \
-H "apns-priority: 10" \
--http2 \
--cert <certificate file> \
https://api.development.push.apple.com/3/device/<device token>
@vncsna
vncsna / bash_strict_mode.md
Created June 6, 2021 01:59 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
import 'dart:ui' as ui;
import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart';
// sample code
/*
class CornerDecorationTest extends StatefulWidget {
@override
_CornerDecorationTestState createState() => _CornerDecorationTestState();
}
@VB10
VB10 / dropdown.dart
Created January 2, 2020 23:50
Flutter dropdown Error: Either zero or 2 or more [DropdownMenuItem]
Widget dropdownWidget(InputDecoration decoration) {
var _value = itemList.isEmpty
? value
: itemList.firstWhere((item) => item.value == value.value);
return DropdownButtonFormField<DropdownItem>(
decoration: decoration,
hint: hint != null ? Text(hint) : null,
items: _itemList,
value: _value,
@serdarb
serdarb / ECDSA
Created October 25, 2018 14:47
using System.Security.Cryptography;
using System.Text;
namespace ConsoleApp
{
class Program
{
class ECDsaHelper
{
public CngAlgorithm Algorithm { get; set; }
@ctrleffive
ctrleffive / android.java
Last active April 21, 2023 03:19
Flutter platform channel sample code.
// ...
import io.flutter.app.FlutterActivity;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
// ...
public class MainActivity extends FlutterActivity {
@branflake2267
branflake2267 / AppDelegate.m
Created April 15, 2018 21:02
Flutter - Native Platform Interactions - Code for the youtube video.
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController;
@keith
keith / testflight.sh
Last active July 1, 2024 14:57
Upload an ipa to testflight using altool
#!/bin/bash
set -euo pipefail
xcrun altool --upload-app --type ios --file "path/to/foo.ipa" --username "$ITC_USER" --password "$ITC_PASSWORD"
@Ara4Sh
Ara4Sh / gist:863e4796801f0453460faddb78e0ea62
Created March 26, 2017 07:51
Nginx Redirect if useragent is android or iphone
# 1
location / {
set $mobile 0;
if ($http_user_agent ~* "iphone|android") {
set $mobile 1;
}
if ($mobile = 1) {
# return or rewrite to somewhere
}
}
@greencoder
greencoder / apns.sh
Created May 11, 2016 17:04
Curl the APNS http/2 API
# Note: You MUST have curl 7.47+ with http/2 support compiled in
curl -v \
-d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-topic: <bundle id>" \
-H "apns-priority: 10" \
--http2 \
--cert <certificate file> \
https://api.development.push.apple.com/3/device/<device token>