This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_phone_number_fancy(number='6615133257', str='DEALs') | |
puts " in TwilioHelper. got " + number.to_s | |
number.include? "+1" | |
number.gsub! "+1", "" | |
str.downcase! | |
kp = {} | |
kp["a"]="2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var emitter = require('events').EventEmitter; | |
var util = require('util'); | |
var dog = function(){}; | |
dog.prototype = { | |
name: "i am a dog", | |
}; | |
// 1st way of inheriting | |
//dog.prototype.__proto__ = new emitter(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mongoose1.js | |
// Store a json object with a schema less property | |
// then retrieve them | |
var mongoose = require('/Users/sarneja/projects/node/node_modules/mongoose/index.js'); | |
var colors = require("/Users/sarneja/projects/node/node_modules/colors/colors"); | |
console.info("mongoose loaded: " + mongoose); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var step = require("step"); | |
var color = require("colors"); | |
/* | |
* A fake task which prints the message sent. | |
* It take upto 2 seconds to do the print. | |
* After printing it will call the callback. | |
*/ | |
var task = function(msg,cb){ | |
console.info(("starting task - " + msg).green); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script> | |
// give number between 1 and 100 | |
function getRandomNumber(){ | |
return Math.floor(Math.random()*100)+1 | |
} | |
// ** config starts **// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
#bla{ | |
display: none | |
} | |
</style> | |
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> | |
<script> | |
$(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MessageDetail | |
include ActiveModel::Validations | |
attr_accessor :body, :length | |
validates :body, presence: true, length: { minimum: 1 } | |
validates :length, presence: true, :numericality => {:greater_than => 0} | |
def initialize(body,length) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>a</title> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script> | |
(function() { | |
var fks = document.createElement('script'); | |
fks.type = 'text/javascript'; | |
fks.async = true; |