Skip to content

Instantly share code, notes, and snippets.

> var myList = document.querySelectorAll('.story-item');
undefined
> myList
myList
[
<div class="story-item">...</div>
,
<div class="story-item">...</div>
,
[...]
@cduruk
cduruk / test.js
Last active December 13, 2015 18:18
You meet a man on the street and he says, “I have two children and one is a son born on a Tuesday.” What is the probability that the other child is also a son?
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function getRandomChild() {
return {
gender: getRandomInt(0, 1),
dayOfBirth: getRandomInt(0, 6)
}
}
@cduruk
cduruk / cloc.txt
Created September 13, 2012 23:05
files
➜ js git:(master) cloc web2 mobile admin
zsh: correct 'cloc' to 'col' [nyae]? n
54 text files.
53 unique files.
0 files ignored.
http://cloc.sourceforge.net v 1.56 T=1.0 s (53.0 files/s, 15353.0 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
@cduruk
cduruk / Email
Created January 5, 2012 19:58
Media Infos for
Hi,
I am trying to encode some videos that were recorded with different iPhones into MP4 formats to make them playable on mobile web browsers like iPhone 3GS, iPhone 4 and Android.
Based on our testing, we found out that the videos Transloadit encodes are using the High video profile which makes them unplayable on the iPhone 3GS mobile web browser.
I have tried several things to lower the profile to Normal but I unfortunately couldn't get it to work. Some things I tried:
Based on:
http://avp.stackexchange.com/questions/2634/how-do-i-specify-baseline-h264-profile-using-ffmbc
@cduruk
cduruk / bio.json
Created December 2, 2011 23:05
My Twitter Bio
{"follow_request_sent": false, "profile_use_background_image": true, "default_profile_image": false, "id": 14911337, "verified": false, "profile_image_url_https": "https://si0.twimg.com/profile_images/1435951122/278751_2239183219008_1230861358_2674983_718503_o_normal.jpg", "profile_sidebar_fill_color": "E6F6F9", "is_translator": false, "profile_text_color": "333333", "followers_count": 1582, "profile_sidebar_border_color": "DBE9ED", "id_str": "14911337", "profile_background_color": "DBE9ED", "listed_count": 43, "status": {"favorited": false, "contributors": null, "truncated": false, "text": "@DeMarko Probably. That whole directory thing is a mess right now, esp. with iOS 5.", "created_at": "Sat Nov 12 00:12:14 +0000 2011", "retweeted": false, "in_reply_to_status_id_str": "135147479170691072", "coordinates": null, "id": 135147857266225153, "source": "<a href=\"http://itunes.apple.com/us/app/twitter/id409789998?mt=12\" rel=\"nofollow\">Twitter for Mac</a>", "in_reply_to_status_id": 135147479170691072, "place":
from foo import view_helpers
class AdminView(views.BaseView):
@view.view_config(route_name='admin.home',
decorator=views.logged_in_view_decorator,
renderer='admin/home.mako')
@view_helpers.require_groups(['employees'])
def home(self):
resp = dict()
resp['page_type'] = 'home'
[user]
name = Can Duruk
email = can@duruk.net
[github]
username = cduruk
[color]
diff = auto
status = auto
branch = auto
@cduruk
cduruk / css3.php
Created August 10, 2011 01:05
Box Shadow
/**
* Output CSS3 box shadows
*
* @param string $xOffset The x offset of the shadow
* @param string $yOffset The y offset of the shadow
* @param string $size Size of the shadow
* @param string $opacity You can either specify an opacity value (0 through 1) or a hex color value
* @param string $location You can specify this optionally as 'inset' and the shadow will be inside of the element instead of outside
*
* @return string
@cduruk
cduruk / sell.txt
Created July 21, 2011 03:52
Macbook Pro
Hardware:
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: MacBookPro5,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.53 GHz
Number of Processors: 1
Total Number of Cores: 2
var getClassedElemets = function(className, getFirst) {
if (typeof getFirst === undefined) getFirst = false;
var els = [];
var all = document.getElementsByTagName('*');
var arrEls = getArrFromNodeList(all);
for (var j=0; j < arrEls.length; ++j) {
var test = arrEls[j];
if (hasClass(test, className)) {