Skip to content

Instantly share code, notes, and snippets.

@acornejo
acornejo / alexcc.json
Last active October 14, 2019 07:28
kc60 keymap
We couldn’t find that file to show.
@acornejo
acornejo / config-server.sh
Created October 8, 2017 03:24
config-server.sh
#!/bin/bash
query_yn() {
local res=""
echo -n "$1: [y,n] "
while [ "$res" != "n" -a "$res" != "y" ]; do
read -s -n 1 res
done
if [ "$res" != "n" ]; then
echo
@acornejo
acornejo / generate-icons.sh
Created December 24, 2016 15:31
generate icons for cellphones (i.e. for use with cordova)
#!/bin/bash
# Copyright Alex Cornejo 2013
# Released under BSD License
generate_icons() {
local SRC_FILE=$1
local DST_DIR=$2
declare -a argSIZES=("${!3}")
for size in "${argSIZES[@]}"; do
#include <iostream>
#include <evt>
using std::cout;
// create custom mouse move event
struct MouseMoveEvent: public evt::Event {
int x;
int y;
MouseEvent(int _x, int _y): evt::Event("mousemove"), x(_x), y(_y) {}
@acornejo
acornejo / clone.js
Created January 9, 2014 20:14
javascript (deep) clone object
function clone(obj) {
// Handle the simple types (string, number, boolean, undefined, null)
if (obj === null || typeof obj !== 'object') return obj;
var copy;
// Handle Date
if (obj instanceof Date) {
copy = new Date();
copy.setTime(obj.getTime());
return copy;