Skip to content

Instantly share code, notes, and snippets.

Ustun Ozgur ustun

Block or report user

Report or block ustun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ustun
ustun / azure_devops_update_build_number.sh
Last active Jun 28, 2019
Azure Devops Set Build Number for Master & PRs
View azure_devops_update_build_number.sh
#!/bin/bash
# Script to set build number in Azure Devops
# We want build number of the following form:
# "build master efab0 20190505 12:12"
# "build pr feature/foo efab0 20190505 12:12"
# Builtin Azure Devops build numbering is insufficient, so we override with this script.
View log_this.el
(require 'ht)
(setq log-this-js-log-format "console.log('%s: ', %s)")
(setq log-this-python-log-format "print(\"%s: \", %s)")
(setq log-this-clojure-log-format "(print \"%s: \" %s)")
(setq log-this-log-formats
(ht ("typescript-mode" log-this-js-log-format)
("js2-mode" log-this-js-log-format)
("js-mode" log-this-js-log-format)
View path.txt
PATH mevzusu cogu programci icin tam anlasilmayan ve her programlama dilinde farkli cozulen bir sorun
ve cok vakit kaybina neden oluyor
peki virtualenv ne demek ona deginelim, aslinda virtualenv'in yaptigi su. Senin PATH'inin basina virtualenv klasorundeki bin klasorunu koyuyor
yaptigi temelde bu
virtualenv calistirmadan once PATH=/usr/bin:/bin diyelim
bu durumda ahmet yazarsan ahmet binary'sini o klasorlerde arayacak
virtualenv'i aktive ettiginde yaptigi aslinda su
PATH=myenv/bin;/usr/bin:/bin
dolayisiyla virtualenv cok da bir sey yapmiyor
virtualenv'i aktiflestirmeden dogrudan o venv icindeki python'u da calistirirsan ayni kapiya cikar
View basic_logging.py
import logging
import logging.config
def configure_logging():
LOG_DIR = "logs/"
LOGGING = {
"version": 1,
"disable_existing_loggers": True,
@ustun
ustun / slim-redux.js
Created Apr 11, 2017 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
View slim-redux.js
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
View a.html
<h1>On Yılda Programlama Öğrenin <sup><a href="#footnote1">(*)</a></sup></h1>
<h3>Peter Norvig <sup><a href="#footnote2">(**)</a></sup></h3>
<hr>
<h2>Neden herkes böyle bir telaş içinde?</h2>
Herhangi bir kitapçıya gittiğinizde Teach Yourself Java in 7 Days (7 Günde Java Öğrenin) benzeri,
size birkaç günde veya birkaç saatte Visual Basic, Windows, Internet (vs.) öğretmeyi vadeden
@ustun
ustun / gist:0aa6885cbf003e65e3f44a3ba254fc77
Created Mar 21, 2017
Hickey on Levelling Up as a Programmer
View gist:0aa6885cbf003e65e3f44a3ba254fc77
From https://disqus.com/home/discussion/jasonrudolph/jasonrudolph_blog_programming_achievements_how_to_level_up_as_a_developer/newest/#comment-287120251
Rich Hickey • 6 years ago
Sorry, I have to disagree with the entire premise here.
A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.
Mastery comes from a combination of at least several of the following:
View gist:648af2ed6053e2edd1611b8308e07ff8
Let's say we have a feed of questions and each question has an answer, and each answer has an id.
We want to find the answer with id=5 and update its like count.
Assume the data structure is nested, so
(def feed (atom {:questions [{:id 1 :answers [{:id 5, text: 'foo', :like-count 4}]}]})
If I know that the answer I'm targeting is at 0th position of 0th question, I can do:
(swap! feed update-in [:questions 0 :answers 0 :like-count] inc)
View gist:d4e94a3977dce29b484d52dda5ce5bae
(update-in foo [:bar :baz] ....)
What I meant was, each part of the path does an equality check of the original
compound data structure.
So, it says, give me the subsection of foo where key is *equal to* :bar.
Here, the predicate that says "key being equal to" is hard-coded.
@ustun
ustun / reducer_as_immutable_class.js
Created Feb 6, 2017
redux reducer from immutable class
View reducer_as_immutable_class.js
var camelCase = require('lodash.camelcase');
const {Map, Record, List} = require('immutable');
class Todo extends Record({ description: null, completed: false }) {
toggle() {
return this.set('completed', !this.completed);
}
}
const InitialTodoApp = Record({
You can’t perform that action at this time.