Skip to content

Instantly share code, notes, and snippets.

@wmleler
wmleler / main2.dart
Last active August 21, 2021 01:44
Matrix #2
// v2: add Gesture detector
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Perspective',
@wmleler
wmleler / main3.dart
Last active August 2, 2018 12:07
Matrix #3
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Perspective',
theme: ThemeData(primarySwatch: Colors.blue),
@abdumu
abdumu / howTo.txt
Last active January 8, 2020 09:18
"This connection is not private" + "Valet" + "iOS Simulator"
-1- edit ~/.composer/vendor/laravel/valet/cli/stubs/openssl.conf
Change:
basicConstraints = CA:FALSE
To:
basicConstraints = CA:TRUE,pathlen:0
save file.
@letsar
letsar / inherited_widget_test.dart
Created January 10, 2018 19:26
Flutter InheritedWidget test
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
void main() {
runApp(new AppContainer());
}
class AppContextData {
@vielhuber
vielhuber / Model.php
Last active July 11, 2023 16:51
custom relationship in eloquent / eager loading #laravel
<?php
public function foos() {
$relation = $this->hasMany('App\Bar');
return $relation; // default behaviour
// modify the query builder
$relation->where('foo','bar');
return $relation;
@Mevrael
Mevrael / WebSocketController.php
Created March 14, 2017 10:40
Laravel + WebSocket (Ratchet/ReactPHP) integration
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Session;
use Ratchet\WebSocket\Version\RFC6455\Connection;
@marc-hughes
marc-hughes / debouce.dart
Last active August 17, 2022 10:11
debounce function for dart
library debounce;
Map timeouts = {};
void debounce(int timeoutMS, Function target, List arguments) {
if(timeouts.containsKey(target)) {
timeouts[target].cancel();
}
Timer timer = new Timer(new Duration(milliseconds: timeoutMS), () {
@corbett
corbett / QuickAndAccurateiOSLocation.m
Created March 17, 2012 15:55
Objective-C to obtain quick and accurate location in iOS
// setup
- (void)viewDidLoad
{
...
self.locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
locationManager.distanceFilter = 250;
self.desiredLocationFreshness = 15.0; // desired freshness in s
self.desiredLocationAccuracy = 100.0; // desired location accuracy in m
@craigs
craigs / aus_post.rb
Created October 29, 2010 03:15
Australia Post's DRC rate calculator
# Interface to Australia Post's DRC rate calculator
#
# Merchant’s web site must display statements re DRC
# It is a condition of use of the DRC that certain statements are prominently displayed on the Merchant’s web site.
# These statements can be found at web site http://www.edeliver.com.au/Templates/ifs/IFS_DRC_Terms.htm in the section headed "Your representations".
class AusPost
AUSPOST_DRC_URL = "http://drc.edeliver.com.au/ratecalc.asp"