Skip to content

Instantly share code, notes, and snippets.

View tomysmile's full-sized avatar

Tomy Ismail tomysmile

  • NITOZA
  • Dubai
View GitHub Profile
@tomysmile
tomysmile / Raspberry and Gammu.md
Last active May 18, 2022 01:02 — forked from damonsk/gist:3955099
GAMMU: Send SMS with Raspberry Pi

Send SMS messages using Raspberry Pi.

Using gammu and Huawei E220

Prepare SD card with wheezy.

Login / complete rasp-config / reboot / login

Set vimrc to prevent annoying ADBC arrow keys

cp /etc/vim/vimrc ~/.vimrc

@tomysmile
tomysmile / javascript-get-ordinal.md
Last active June 18, 2022 15:13
JavaScript: Get Ordinal
function getOrdinal(n) {
   var s=["th","st","nd","rd"],
       v=n%100;
   return n+(s[(v-20)%10]||s[v]||s[0]);
}
@tomysmile
tomysmile / gist:e0d030723f38d61f373b
Created August 19, 2015 08:02
JavaScript: Check if empty
function empty(data)
{
if(typeof(data) == 'number' || typeof(data) == 'boolean')
{
return false;
}
if(typeof(data) == 'undefined' || data === null)
{
return true;
}
@tomysmile
tomysmile / NodeJS on Mac OSX.md
Last active October 9, 2015 22:52
Node: Install NodeJS on Mac OSX.md

Install NodeJS and NPM On Mac OS X for Homebrew Users

If you're a Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together.

Homebrew

I assume you have Homebrew. If not, go get it. It’s awesome for OSX. You can install tons of great stuff quickly and efficiently with it. Instructions are at the link or for your convenience, run this:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@tomysmile
tomysmile / mac-new-INSTALLATION.md
Last active July 12, 2016 04:33 — forked from DenisIzmaylov/INSTALLATION.md
Mac OS X 10.11 El Capitan: fresh install with Node.js (io.js) Developer Environment

OS X 10.11 (El Capitan) / Node.js and io.js Developer Environment

Custom recipe to get OS X 10.11 El Capitan running from scratch with useful applications and Node.js Developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after fresh install.

Content

@tomysmile
tomysmile / Getting Started Web Framework.md
Last active October 10, 2015 02:34
Web: Getting Started

Getting-Started

Below are summary of getting started from several famous web/mobile framework

$ npm install -g cordova ionic
$ ionic start myApp tabs
@tomysmile
tomysmile / Using NVM.md
Last active January 10, 2017 05:29
Node: Install NVM

Installing NVM

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
$ echo source "~/.profile" >> ${HOME}/.bash_profile
$ source ~/.profile

$ nvm install 0.12
@tomysmile
tomysmile / vagrant-shortcut.md
Last active December 17, 2019 19:47
Vagrant: Shortcut command

Creating initial vagrant file

$ vagrant init

Running precise32

$ vagrant init hashicorp/precise32
@tomysmile
tomysmile / mongo-like-query.md
Created October 17, 2015 12:42
mongo: query like
db.users.insert({name: 'paulo'})
db.users.insert({name: 'patric'})
db.users.insert({name: 'pedro'})
db.users.find({name: /a/})  //like '%a%'

out: paulo, patric

@tomysmile
tomysmile / node-cors-express-allow.md
Created October 18, 2015 15:36
Node: CORS acceptance

// Setup express

var app = express();
var server = require('http').createServer(app);

// CORS acceptance

app.use(function(req, res, next) {
 res.header("Access-Control-Allow-Origin", "*");