Skip to content

Instantly share code, notes, and snippets.

View elango's full-sized avatar

Elango elango

View GitHub Profile
import os
org = "com.example"
name = "app_name"
cmd = "flutter create --org " + org + " --project-name " + name + " .";
packages = [
"cached_network_image",
"collection",
"copy_with_extension",
"equatable",
@escamoteur
escamoteur / nextField.dart
Created September 13, 2019 12:22
So easy is it now to implement a next field behavior for forms, meaning that the focus is moved as soon the user tabs the next button on the keyboard
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
TabController _tabController;
FocusScopeNode _node = FocusScopeNode(); /// <-----------------
@override
void initState() {
_tabController = TabController(length: 3, vsync: this);
@hays-hutton
hays-hutton / schema.sql
Created March 16, 2016 16:31
A Simplified Schema Example for PostgREST
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE TABLE IF NOT EXISTS
users (
email TEXT PRIMARY KEY CHECK ( email ~* '^.+@.+\..+$' ),
pass TEXT NOT NULL CHECK (length(pass) < 256),
role NAME NOT NULL CHECK (length(role) < 256)
);
CREATE TABLE IF NOT EXISTS
@squiidz
squiidz / jwt-example.go
Created May 24, 2015 19:31
JWT in Golang
package main
import (
"fmt"
"net/http"
"time"
"github.com/go-zoo/bone"
"github.com/go-zoo/claw"
mw "github.com/go-zoo/claw/middleware"
@nmerouze
nmerouze / main.go
Last active March 2, 2022 16:36
JSON-API with Go and MongoDB: Final Part
package main
import (
"encoding/json"
"log"
"net/http"
"reflect"
"time"
"github.com/gorilla/context"
@nmerouze
nmerouze / main.go
Last active May 6, 2021 16:40
Example for "Build Your Own Web Framework in Go" articles
package main
import (
"database/sql"
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"time"
description "start and stop the go program 'my-project'"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
env USER='ubuntu'
env APP_DIR='/home/ubuntu/go/src/github.com/your-username/your-project-name/'
env APP_EXEC='your-project-name'
exec start-stop-daemon —start —chuid ${USER} —chdir ${APP_DIR} —exec ${APP_DIR}${APP_EXEC}
@cryptix
cryptix / LICENSE
Last active June 26, 2024 01:30
example of using JWT for http authentication in go
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE S
@tristanwietsma
tristanwietsma / auth.go
Created May 15, 2014 04:15
Golang web server example
package main
import (
"encoding/base64"
"net/http"
"strings"
)
type handler func(w http.ResponseWriter, r *http.Request)
// Photoshop Script to Create iPhone Icons from iTunesArtwork // // WARNING!!! In the rare case that there are name collisions, this script will // overwrite (delete perminently) files in the same folder in which the selected // iTunesArtwork file is located. Therefore, to be safe, before running the // script, it's best to make sure the selected iTuensArtwork file is the only // file in its containing folder. // // Copyright (c) 2010 Matt Di Pasquale // Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and