Skip to content

Instantly share code, notes, and snippets.

View hotdang-ca's full-sized avatar

James Robert Perih hotdang-ca

View GitHub Profile
@akisute
akisute / NetworkInformation.h
Created November 4, 2010 07:28
NetworkInformation.h Objective-C class to retrieve network information. Licensed under MIT License.
//
// NetworkInformation.h
//
// Created by akisute on 10/10/07.
// Copyright 2010 株式会社ビープラウド.
/*
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
@OnesimusUnbound
OnesimusUnbound / quote.txt
Last active August 16, 2023 16:24
Programming Quotes
[T]he difference between a bad programmer and a
good one is whether he considers his code or his
data structures more important. Bad programmers
worry about the code. Good programmers worry about
data structures and their relationships.
-- Linus Torvalds
~~~
Clarity and brevity sometimes are at odds.
When they are, I choose clarity.
-- Jacob Kaplan-Moss
@alisterlf
alisterlf / gist:3490957
Created August 27, 2012 18:10
JAVASCRIPT:Remove Accents
function RemoveAccents(strAccents) {
var strAccents = strAccents.split('');
var strAccentsOut = new Array();
var strAccentsLen = strAccents.length;
var accents = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž';
var accentsOut = "AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz";
for (var y = 0; y < strAccentsLen; y++) {
if (accents.indexOf(strAccents[y]) != -1) {
strAccentsOut[y] = accentsOut.substr(accents.indexOf(strAccents[y]), 1);
} else
@mgechev
mgechev / basic-tcp-server.dart
Created June 17, 2013 15:55
Basic TCP server in Dart
import 'dart:core';
import 'dart:async';
import 'dart:io';
void startServer() {
Future<ServerSocket> serverFuture = ServerSocket.bind('0.0.0.0', 55555);
serverFuture.then((ServerSocket server) {
server.listen((Socket socket) {
socket.listen((List<int> data) {
String result = new String.fromCharCodes(data);
@webinista
webinista / array.chunk.js
Last active March 29, 2023 23:02
Array.prototype.chunk: Splits an array into an array of smaller arrays containing `groupsize` members
/*
Split an array into chunks and return an array
of these chunks.
With kudos to github.com/JudeQuintana
This is an update example for code I originally wrote 5+ years ago before
JavaScript took over the world.
Extending native objects like this is now considered a bad practice, so use
@FaisalAbid
FaisalAbid / Redis Dart Connection Pool
Last active February 19, 2023 22:06
Redis Dart Connection Pool
library db.redis;
import 'dart:async';
import 'package:redis_client/redis_client.dart';
import 'package:connection_pool/connection_pool.dart';
class Redis {
static Future<RedisClient> getRedis() async {
ManagedConnection managedConnection = await new RedisPool().getConnection();
@firatkucuk
firatkucuk / delete-slack-messages.js
Last active May 1, 2024 04:17
Deletes slack public/private channel messages, private chat messages and channel thread replies.
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = 'SLACK TOKEN';
// Legacy tokens are no more supported.
// Please create an app or use an existing Slack App
@Pulimet
Pulimet / AdbCommands
Last active May 1, 2024 20:00
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@hotdang-ca
hotdang-ca / distance.go
Last active March 14, 2024 06:58
Golang code to calculate distance between two lat/lng decimal coordinates.
package main
import (
"math"
"fmt"
)
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//::: :::
//::: This routine calculates the distance between two points (given the :::
@hotdang-ca
hotdang-ca / Keypad.tsx
Last active September 8, 2023 08:58
Numeric Keypad in TypeScript React
import * as React from 'react';
import { KeypadKey } from './KeypadKey';
import './styles.less';
export interface IKeypadProps
{
onKeyPressed: (keyPressed: KeypadKeys) => void;
}