Skip to content

Instantly share code, notes, and snippets.

@judearasu
judearasu / questionMarks.js
Created April 6, 2020 02:23
Questions Marks
function QuestionsMarks(str) {
let numbers = [];
let inputStrArr = str;
let numbersWithIndex = [];
let result = false;
for (let i = 0; i < inputStrArr.length; i++) {
if (parseInt(inputStrArr[i], 10)) {
numbers.push(inputStrArr[i]);
numbersWithIndex.push({
@judearasu
judearasu / findIntersection.js
Created March 8, 2020 01:33
Find Intersection
function findIntersection(strArr) {
let result = [];
if (Array.isArray(strArr)) {
let arg1 = strArr[0].split(",").map(elem => elem.trim());
let arg2 = strArr[1].split(",").map(elem => elem.trim());
arg1.filter(a => {
if (arg2.includes(a)) {
result.push(a.trim());
}
});
@judearasu
judearasu / dabblet.css
Last active August 29, 2015 14:09
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;

##JavaScript specific Questions

  • Which JavaScript libraries have you used?
  • How is JavaScript different from Java?
  • What are undefined and undeclared variables?
  • What is an expression?
  • What is a statement?
  • Give an example of a function declaration
  • Give an example of a function expression
  • Explain what the DOM is and some best practices for interacting with it.
@judearasu
judearasu / clone-object.js
Last active August 29, 2015 14:07
Javascript test
describe('clone object', function () {
it('should clone an object', function () {
var expected = {name: 'Ahmed', age: 27, skills: ['cycling', 'walking', 'eating']},
obj = {};
if (expected instanceof Object){
obj = expected.constructor();
for (var attr in expected) {
if (expected.hasOwnProperty(attr))
obj[attr] = expected[attr];
}
@judearasu
judearasu / server.js
Created December 1, 2013 18:06
Basic static web server with logger using node.js
#!/usr/bin/env node
/**
*
* Basic static web server with logger using node.js.
* Listen on port 8880, IP defaults to 127.0.0.1
*
**/
'use strict';
var http = require("http"),
@judearasu
judearasu / Gemfile
Created October 14, 2012 03:29
Serving static sites with rack
source :rubygems
gem 'sinatra'
gem 'multi_json'
gem 'rack'
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@judearasu
judearasu / mixi_graph.rb
Created May 22, 2012 17:27 — forked from nov/mixi_graph.rb
mixi OAuth & Graph API sample
require 'rubygems'
require 'active_support/all'
require 'oauth2'
config = {
:mode => :token,
:client_id => SET_YOUR_OWN,
:client_secret => SET_YOUR_OWN,
:redirect_uri => SET_YOUR_OWN,
:authorization_code => SET_YOUR_OWN,
@judearasu
judearasu / gist:1800201
Created February 11, 2012 14:46 — forked from fxn/gist:1798985
require 'active_support/inflector'
require 'benchmark'
# QUICK HACK
class RuleSet
def initialize
@rules = []
@regexp = nil
end