Visit: bit.do/websec-gist for links to resources
- Variables are containers for storing data values.
Visit: bit.do/websec-gist for links to resources
mixin JWTToObject { | |
Map<String, dynamic> parseJwt(String token) { | |
final parts = token.split('.'); | |
if (parts.length != 3) { | |
throw Exception('invalid token'); | |
} | |
final payload = _decodeBase64(parts[1]); | |
final payloadMap = json.decode(payload); | |
if (payloadMap is! Map<String, dynamic>) { |
// Assumption is, all the fields hold the same kind of value | |
// An entry from the database together with the ID | |
class Measurement { | |
final int id; | |
final String name; | |
Measurement({this.id, this.name}); | |
} | |
// Field Instance class defines the variables that will be used for each field | |
class FieldInstance { |
<?php | |
use Faker\Generator as Faker; | |
use App\Member; | |
$factory->define(App\MemberDeposit::class, function (Faker $faker) { | |
$members = Member::all()->pluck('member_id')->toArray(); | |
return [ | |
'member_id' => $faker->randomElement($members), |
import 'package:moor/moor.dart'; | |
import 'package:rxdart/rxdart.dart'; | |
part 'shopping_cart.g.dart'; | |
class ShoppingCarts extends Table { | |
IntColumn get id => integer().autoIncrement()(); | |
} | |
class BuyableItems extends Table { |
If you need to move a lot of files between DO server you can move these through SCP over the internal private Digital Ocean network.
NB both droplets need to be within the same region
To do this you need:
eth1
is enabled for both droplets if not already - see https://www.digitalocean.com/community/tutorials/how-to-enable-digitalocean-private-networking-on-existing-dropletsPivot tables can be confusing and a little hard to wrap your head around at first. In this quick article we are going to dive into what a pivot table is, how to create one and finally how to use the pivot table. Let's dive in!
A pivot table is used to connect relationships between two tables. Laravel provides a Many To Many
relationship where you can use a pivot table.
void main() => print(List.generate(10, (i) => i).chunk(3)); | |
extension ListChunkerExtension on List { | |
List chunk(int chunkLength) { | |
if ((chunkLength ?? 0) <= 0 || (this ?? []).length == 0) | |
return this; | |
var chunks = []; | |
for (var i = 0; i < this.length; i += chunkLength) { | |
chunks.add(this.sublist( | |
i, i + chunkLength > this.length ? this.length : i + chunkLength)); |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- master | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged | |
steps: |
- name: Create .env | |
run: | | |
echo "API_KEY_WEB=${{ secrets.API_KEY_WEB }}" >> .env | |
echo "API_KEY_ANDROID=${{ secrets.API_KEY_ANDROID }}" >> .env | |
# What this will do is that it will get the key from the secrets in the repository and push | |
# then into the .env file before you can build your APK or project |