Skip to content

Instantly share code, notes, and snippets.

View attomos's full-sized avatar
💆‍♀️

Nattaphoom Chaipreecha attomos

💆‍♀️
View GitHub Profile
# In your Rakefile add your font in the app setup.
Motion::Project::App.setup do |app|
# App Settings
app.fonts = ['st-marie.ttf']
end
# Make sure your st-marie.ttf is in your resources directory
# To use in your app do the following
my_font = UIFont.fontWithName 'St Marie', size: 32
#!/usr/bin/env node
var argv = require('optimist').argv;
var express = require('express');
var app = express();
var msg = argv.m || 'Usage: reminder.js -m [message]';
process.stdout.write('\x1B[H\x1B[J');
process.stdout.write('\x1b[1;38;5;203m' + msg);
app.listen(3000);
var EventEmitter = require('events').EventEmitter
var emitter = new EventEmitter()
var util = require('util')
emitter.on('newListener', newListener)
function newListener() {
console.log('new listener added')
}
emitter.on('removeListener', removeListener)

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"

npm adduser

#!/usr/bin/env node
// From http://stackoverflow.com/a/16351842/606355
var stdin = process.openStdin();
var data = "";
stdin.on('data', function(chunk) {
data += chunk;
@attomos
attomos / download.js
Created May 4, 2014 11:39
Node.js script for download "Operating Systems: Three Easy Pieces" (OSTEP) ebook :)
#!/usr/bin/env node
/**
* Node.js script for download "Operating Systems: Three Easy Pieces" (OSTEP) ebook :)
* well.html is an excerpt from http://pages.cs.wisc.edu/~remzi/OSTEP/
*/
var fs = require('fs');
var mkdirp = require('mkdirp');
var cheerio = require('cheerio');
var request = require('request');
# config/locales/en.yml
en:
exception:
show:
not_found:
title: "Not Found"
description: "The page you were looking for does not exists."
internal_server_error:
title: "Internal Server Error"
@attomos
attomos / .vimrc
Last active August 29, 2015 14:07
My minimal .vimrc
let mapleader = " "
syntax on
filetype plugin on
colorscheme peachpuff
set number
set nobackup
set ai
set smartindent
autocmd BufRead *.py set sts=4 st=4 ts=4
autocmd BufNew *.py set sts=4 st=4 ts=4
@attomos
attomos / GitForWindowsSetup.md
Last active August 29, 2015 14:27 — forked from dmangiarelli/GitForWindowsSetup.md
How to setup Git for Windows

How to setup Git for Windows

I know this document seems long, but it shouldn't be too difficult to follow. This guide is based on Windows, but every program here have Linux/Mac equivalents, and in most cases they're built-in. So, take a deep breath and go step by step.

The steps below are for [GitHub][github], but the steps are almost idential for Bitbucket, Heroku, etc.

Cmder

The first thing you'll want to do is to download and install [Cmder][cmder], which is a terminal program that serves as excellent replacement for the built-in cmd.exe. It's not a shell itself, so it supports running plain old cmd.exe commands and running PowerShell.

@attomos
attomos / irc.md
Created December 6, 2015 08:54 — forked from xero/irc.md
irc cheat sheet

#IRC Reference

Not intended as a guide for newbies, more like a "cheat sheet" for the somewhat experienced IRC user, especially one who wields some power over a channel.

##The Basics

  • /join #channel
    • Joins the specified channel.
  • /part #channel
    • Leaves the specified channel.