Skip to content

Instantly share code, notes, and snippets.

View huseyinyilmaz's full-sized avatar

Huseyin Yilmaz huseyinyilmaz

  • Balikesir, Turkey
View GitHub Profile
(function injected(eventName, injectedIntoContentWindow)
{
let checkRequest;
/*
* Frame context wrapper
*
* For some edge-cases Chrome will not run content scripts inside of frames.
* Website have started to abuse this fact to access unwrapped APIs via a
* frame's contentWindow (#4586, 5207). Therefore until Chrome runs content
@huseyinyilmaz
huseyinyilmaz / questions.org
Last active June 30, 2018 19:14
Programming questions for middleschoolers.

Questions

Find shortest Name

Given name last name objects find the person with shortest name.

example

names = [{'name': 'huseyin', 'last_name': 'yilmaz'},
         {'name': 'sila', 'last_name': 'yilmaz'}]
get_shortest(names)
>>> {'name': 'sila', 'last_name': 'yilmaz'}
from collections import defaultdict
def run():
print("RUNNING")
return 'val'
test = {'store':1}
print(test.get('store', run))
print(test.get('not_stored', run))
test2 = defaultdict(run)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Default shortcuts

  • C-x space : rectangular mark
  • M-/ : debrev word (uses current open buffers.)
  • C M - h : mark defun (mark current function.)
  • C-u 5 … : repeat following action 5 times.
  • C-x [ : go to beginning of the page
  • C-x ] : go to end of the page

Highlight mode

  • C-x w . : highlight current word.
  • C-x w r : unhighlight
@huseyinyilmaz
huseyinyilmaz / venvtest.hs
Created November 17, 2016 01:07
Setting path on a shell script:
#!/usr/bin/env stack
-- stack --install-ghc runghc --package turtle
{-# LANGUAGE OverloadedStrings #-}
import Turtle
import System.Process(callProcess)
import qualified Data.Text as Text
-- adds virtualenv wrapper to path
@huseyinyilmaz
huseyinyilmaz / .tmux.conf
Last active March 19, 2020 19:15
My Tmux configuration
unbind C-b
set -g prefix C-q
bind-key C-q send-prefix
# enable vi keys.
# setw -g mode-keys vi
# set window split
bind-key v split-window -h
bind-key s split-window -v
@huseyinyilmaz
huseyinyilmaz / first_unique_element.py
Created August 30, 2016 17:46
Find first unique element in a list.
from collections import Counter
def get_unique(ls):
uniques = set(i
for (i, c) in Counter(ls).iteritems()
if c == 1)
return next((e for e in ls if e in uniques), None)
@huseyinyilmaz
huseyinyilmaz / perms.hs
Created July 16, 2016 05:37
Return all permutations of given list
module Main where
-- inserts a to all possible places in list bs
-- insert 1 [2,3] -> [[1,2,3], [2,1,3], [2,3,1]]
insert :: t -> [t] -> [[t]]
insert a [] = [[a]]
insert a bs@(b:rest) = (a:bs):fmap (b:) (insert a rest)
-- Returns all permitations of given list
-- perms [1,2,3] -> [[1,2,3],[2,1,3],[2,3,1],[1,3,2],[3,1,2],[3,2,1]]
-- https://leetcode.com/problems/rectangle-area/
module Main where
import Test.HUnit
import Control.Monad(guard)
import Data.List(nub)
-- Data Types
data Point = Point Int Int
deriving (Eq, Show)