Skip to content

Instantly share code, notes, and snippets.

View nirajkrz's full-sized avatar

ncode nirajkrz

View GitHub Profile
@nirajkrz
nirajkrz / app.js
Last active August 29, 2015 14:13 — forked from jgoux/app.js
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
@nirajkrz
nirajkrz / app.js
Last active August 29, 2015 14:13 — forked from jgoux/app.js
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
@nirajkrz
nirajkrz / README.md
Last active August 29, 2015 14:16 — forked from hofmannsven/README.md
// Bonfire: Roman Numeral Converter
// Author: @nirajkrz
// Challenge: http://www.freecodecamp.com/challenges/bonfire-roman-numeral-converter
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function convert(num) {
if (!+num)
return false;
var digits = String(+num).split(""),
key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM",
// Bonfire: Where art thou
// Author: @nirajkrz
// Challenge: http://www.freecodecamp.com/challenges/bonfire-where-art-thou
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function where(collection, source) {
var arr = [];
// What's in a name?
var keys = Object.keys(source);
// Filter array and remove the ones that do not have the keys from source.
// Bonfire: Search and Replace
// Author: @nirajkrz
// Challenge: http://www.freecodecamp.com/challenges/bonfire-search-and-replace
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function myReplace(str, before, after) {
// Find index where before is on string
var index = str.indexOf(before);
// Check to see if the first letter is uppercase or not
if (str[index] === str[index].toUpperCase()) {
// Bonfire: Pig Latin
// Author: @nirajkrz
// Challenge: http://www.freecodecamp.com/challenges/bonfire-pig-latin
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function translate(str) {
// Create variables to be used
var pigLatin = '';
var regex = /[aeiou]/gi;
// Check if the first character is a vowel
// Bonfire: DNA Pairing
// Author: @nirajkrz
// Challenge: http://www.freecodecamp.com/challenges/bonfire-dna-pairing
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function pair(str) {
/*The DNA strand is missing the pairing element. Take each character, get its pair, and return the results as a 2d array.
Base pairs are a pair of AT and CG. Match the missing element to the provided character.
// Bonfire: Missing letters
// Author: @nirajkrz
// Challenge: http://www.freecodecamp.com/challenges/bonfire-missing-letters
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function fearNotLetter(str) {
// Create our variables.
var firstCharacter = str.charCodeAt(0);
var valueToReturn = '';
var secondCharacter = '';
// Bonfire: Boo who
// Author: @nirajkrz
// Challenge: http://www.freecodecamp.com/challenges/bonfire-boo-who
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function boo(bool) {
// What is the new fad diet for ghost developers? The Boolean.
//Check if a value is classified as a boolean primitive. Return true or false.
return typeof bool === 'boolean';