Skip to content

Instantly share code, notes, and snippets.

View inancgumus's full-sized avatar

İnanç Gümüş inancgumus

View GitHub Profile
'''
Euclide's Theorem 3.3 from Book IX
Finding perfect numbers.
Perfect number is a number that is the sum of its proper divisors.
Examples:
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14
INFO global: Vagrant version: 1.7.2
INFO global: Ruby version: 2.0.0
INFO global: RubyGems version: 2.0.14
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.2/bin/vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/bin/../embedded"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_DETECTED_OS="Darwin"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1"
INFO global: VAGRANT_LOG="debug"
==> default: Configuring cache buckets...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
rm -rf /home/vagrant/.npm
Stdout from the command:
# FOR AUTOMATIC SYNCING AWESOMENESS.
@inancgumus
inancgumus / builder pattern in javascript.js
Last active March 27, 2016 13:11
this pattern has usually been used in Java for testing. but, in javascript, it's very easy to do without the boilerplate code hassle.
// general helper to create the builder pattern automatically
var make = function(klass) {
return { with: function(extendWithThis) { return Object.assign(klass, extendWithThis) } }
}
// let's make a spaghetti
var Pasta = { ingredients: [] }
var spaghetti = make(Pasta).with({
ingredients: [ 'mashroom', 'onion' ]
@inancgumus
inancgumus / App.js
Created April 16, 2016 18:10 — forked from jesseditson/App.js
ES6 & React Sticky scroll higher-order component example
import React from 'react'
import MyComponent from '../components/MyComponent'
export default class App extends React.Component {
render() {
return <MyComponent topMargin="10"/>
}
}
@inancgumus
inancgumus / readability.js
Created August 12, 2016 20:29 — forked from jakedahn/readability.js
Readability.js
/*jslint undef: true, nomen: true, eqeqeq: true, plusplus: true, newcap: true, immed: true, browser: true, devel: true, passfail: false */
/*global window: false, readConvertLinksToFootnotes: false, readStyle: false, readSize: false, readMargin: false, Typekit: false, ActiveXObject: false */
var dbg = (typeof console !== 'undefined') ? function(s) {
console.log("Readability: " + s);
} : function() {};
/*
* Readability. An Arc90 Lab Experiment.
* Website: http://lab.arc90.com/experiments/readability
@inancgumus
inancgumus / gist:71a72f472343f38b27b4e53ea4d00acb
Last active October 20, 2020 22:15
Restore github commit

If you've made a wrong forceful push or just want to recover from old commits in github, then you can use this command flow:

# find the commit, just like git reflog
curl -u <username> https://api.github.com/repos/:owner/:repo/events

# create a new branch from the commit sha found in previous step
curl -u <github-username> 
  -X POST -d ‘{“ref”:”refs/heads/<new-branch-name>”, “sha”:”<sha-from-step-1>"}’ 
 https://api.github.com/repos/:owner/:repo/git/refs
@inancgumus
inancgumus / _.md
Created August 26, 2016 23:51
test
@inancgumus
inancgumus / index.html
Last active August 26, 2016 23:56 — forked from anonymous/index.html
d3 scatterplot experiment // source http://jsbin.com/zizunel
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>d3 starter kit</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.js"></script>
<style id="jsbin-css">
/* Styles go here */