Skip to content

Instantly share code, notes, and snippets.

View hendrikswan's full-sized avatar

hendrik swanepoel hendrikswan

View GitHub Profile
@hendrikswan
hendrikswan / main.dart
Created November 29, 2022 17:26
solar-cliff-5547
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@hendrikswan
hendrikswan / main.dart
Created November 29, 2022 17:23
keen-cliff-3427
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@hendrikswan
hendrikswan / .gitignore
Created October 12, 2011 19:20
sync-putio-files
credentials.txt
series_sort.py
*.pyc
@hendrikswan
hendrikswan / positionIndexedItem.ts
Created January 10, 2021 10:46
TS implementation of reordering items with index properties
/**
* Move item in array.
* NOTE: 2 splice operations will occur.
* First splice will briefly remove item array, second splice re-insert it into desired location.
* @see https://jsperf.com/array-prototype-move
*/
function moveItemInArray(
array: any[],
moveIndex: number,
toIndex: number
const port = 8000;
io.listen(port);
console.log('listening on port ', port);
@hendrikswan
hendrikswan / .eslintrc
Last active September 29, 2020 09:18
Packages and build config for Build Cross Platform React Native Apps with Exponent and Redux
{
"extends": "airbnb/base",
"plugins": [
"react"
],
"env": {
"node": true,
"jasmine": true,
},
"rules": {
@hendrikswan
hendrikswan / app.rb
Created December 20, 2011 21:29
sample sinatra mongodb service
require 'sinatra'
require 'mongoid'
require 'json'
require "sinatra/reloader" if development?
Mongoid.load!("mongoid.yml")
class Price
include Mongoid::Document
const io = require('socket.io')();
const port = 8000;
io.on('connection', (client) => {
client.on('subscribeToTimer', (interval) => {
console.log('client is subscribing to timer with interval ', interval);
setInterval(() => {
client.emit('timer', new Date());
}, interval);
@hendrikswan
hendrikswan / loadData.js
Last active May 7, 2019 16:54
A redux thunk middleware example
function loadData() {
return (dispatch) => {
fetch('/a/fake/url')
.then(response => {
if (!response.ok) {
// dispatching a downstream action
return dispatch(requestFailedAction());
}
return response.json();
})
const handleDrawingEvent = line => ({
line,
type: 'LINE_DRAWN'
})
const drawingSyncSuccess = () => ({
type: 'DRAWING_SYNC_SUCCESS',
})
const drawingSyncFailure = () => ({