Skip to content

Instantly share code, notes, and snippets.

View ddeveloperr's full-sized avatar
👨‍💻
Doist

Kemal C. ddeveloperr

👨‍💻
Doist
View GitHub Profile
@ddeveloperr
ddeveloperr / diff.js
Last active October 18, 2015 20:07
Bonfire: Diff Two Arrays - I had stuck here and finally figured out, pick up the right solution!
function diff(a1, a2) {
var a = {}, diff = [];
for(var i = 0; i < a1.length; i++) {
a[a1[ i ]] = a1[ i ];
}
for(var j=0; j < a2.length; j++) {
if(a[a2[ j ]]) {
delete a[a2[ j ]];
} else {
@ddeveloperr
ddeveloperr / clean_up.md
Last active October 16, 2015 17:59
Clean up command in Linux
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get autoremove
@ddeveloperr
ddeveloperr / how_to_contribute.md
Last active October 22, 2015 16:56
How to Contributing on github!

========================= How to Contributing on github!

We welcome contributed improvements and bug fixes via the usual workflow:

  • Fork this repository
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
@ddeveloperr
ddeveloperr / ruby_colon.rb
Last active July 26, 2023 14:28
ruby Colon access operator explained with example
# Double Colon (::) is namespace resolution. It can also call Class Level Constants. So when you do this:
MyModule::MyClass::MySubClass
MyModule::MyClass::MySubClass::CONSTANT
# it is calling the name space of:
module MyModule
class MyClass
class MySubClass
CONSTANT = 'test'
@ddeveloperr
ddeveloperr / Guess The Number game.markdown
Created November 15, 2015 08:13
Guess The Number game
@ddeveloperr
ddeveloperr / ruby_on_cloud9.md
Last active December 14, 2020 21:05
Start Ruby on Rails and Ruby Sinatra app on Cloud9!

Run Ruby on Rails/Sinatra app on Cloud9 IDE

##Problem:

I spent hours trying to run up a Ruby web server using Sinatra on Cloud 9. The cloud9 IDE instructions on the Output screen say:

Your code is running at http://<project-name>.<username>.c9.io'.
Important: use 'ruby app.rb -p $PORT -b $IP' to run your server apps!

In fact, these are the instructions for a Rails application, and the -b switch is invalid for Sinatra applications, which I discovered when using the Terminal window!!!

<!DOCTYPE html>
<html>
<head>
<title>jQuery Example 1</title>
<style>
.red {
color: red;
}
</style>
@ddeveloperr
ddeveloperr / place_func_anywhere.js
Last active January 13, 2016 19:49
JavaScript allows you to place functions anywhere in your file
// WHY JavaScript allows you to place functions anywhere in your file
// Link to my blog: https://ddeveloperrblog.wordpress.com/2016/01/13/why-javascript-allows-you-to-place-functions-anywhere-in-your-file/
var radius = 9;
var myCircleArea = circleArea(radius);
console.log(myCircleArea);
function circleArea(r) {
var a = Math.PI * r * r;
return a;
@ddeveloperr
ddeveloperr / desktop_notification.js
Created January 25, 2016 22:27
This part of code is responsible for desktop notification :)
// This part of code is responsible for desktop notification :)
function notifyMe(title, options) {
// Check if the browser supports notifications
if (!("Notification" in window)) {
console.log("This browser does not support desktop notification");
}
// Check whether notification permissions have alredy been granted
else if (Notification.permission === "granted") {