Skip to content

Instantly share code, notes, and snippets.

@courajs
courajs / on_suspend.sh
Last active October 6, 2022 18:21
Run a command each time you suspend vim with ctrl+z
# Current unix time in millisecond
function ms() {
echo $(($(date +%s%N)/1000000))
}
# If we suspend vim (ctrl-z), run the on-suspend command and then
# re-foreground vim. If we exit fully, return to the shell.
function post_vim() {
# 148 status code indicate the previous command was suspended
if [ ! $? = 148 ]; then return; fi
@courajs
courajs / click.c
Created April 6, 2022 21:57 — forked from rsp/click.c
// Compile instructions:
//
// gcc -o click click.c -Wall -framework ApplicationServices
#include <ApplicationServices/ApplicationServices.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
int x = 0, y = 0, n = 1;
float duration = 0.1;

Keybase proof

I hereby claim:

  • I am courajs on github.
  • I am courajs (https://keybase.io/courajs) on keybase.
  • I have a public key ASDQM2f55XEJuta3q5dKF9ZHHjBEu2H4M0MKPvNrCiF8_go

To claim this, I am signing this object:

@courajs
courajs / application.controller.js
Last active May 24, 2018 17:29
Component Subexpressions one-way by default?
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
val1: 8,
val2: 8
});
@courajs
courajs / chatServer.js
Created September 8, 2017 17:48 — forked from creationix/chatServer.js
A simple TCP based chat server written in node.js
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
0x1E65F71b024937b988fdba09814d60049e0Fc59d
{{#each publications as |publication|}}
<h1>Hello, {{publication.name}}</h1>
{{else}}
No publications
{{/each}}
@courajs
courajs / helpers-radio-button.js
Created June 3, 2014 18:04
Simpler explicit name radio buttons
import RadioView from '../views/radio';
export default Ember.Handlebars.makeViewHelper(RadioView);
import Ember from 'ember';
const {
Component
} = Ember;
export default Component.extend({
willRender() {
this.set('timerStart', new Date());
},
@courajs
courajs / controllers.application.js
Created April 26, 2017 20:25 — forked from machty/controllers.application.js
ember-concurrency starter
import Ember from 'ember';
import { task, timeout } from 'ember-concurrency';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
myTask: task(function * () {
let didConfirm = yield this.get('getConfirmation').perform("Are you sure?");
if (didConfirm) {
alert("woot");