Skip to content

Instantly share code, notes, and snippets.

@turhn
turhn / tckn_verifier.rb
Last active August 29, 2015 14:05
TCKN Verifier - Turkish Citizenship Number Checker - TCKN Kimlik No Doğrulama
###
# Author : Turhan Coskun
# Name : TCKN Number Verification - TCKN Dogrulama
# Usage : ruby tckn_verifier.rb <turkish citizenship number>
###
raw_id_number = ARGV[0] # Assign the first argument of the program to the variable
# Extensions of the String class
class String
@turhn
turhn / snippets.cson
Created August 14, 2014 19:01
Atom.IO Editor - Jekyll Language Highlighter Snippet for GitHub Markup (.md)
#usage : hi<tab>
'.source.gfm':
'Highlight Markup':
'prefix': 'hi'
'body': '{% highlight $1 %}\n{% endhighlight %}'
@turhn
turhn / daterange_filter.js
Created August 19, 2014 16:02
Date range filter for Angular.JS
app.filter('daterange', function() {
return function(items, startDate, endDate) {
var filteredResult = [];
// Parse from the filter format 'dd/mm/yyyy' (Turkish culture)
function parseDateFromFilter(strDate) {
var parts = strDate.split('/');
return new Date(parts[2], parts[1] - 1, parts[0]);
}
@turhn
turhn / faprepender.css
Created August 24, 2014 21:22
Prepend FontAwesome In Placeholder
input.date-picker::-webkit-input-placeholder::before { font-family: fontAwesome; content: '\f073 '; color: inherit }
input.date-picker::-moz-placeholder::before { font-family: fontAwesome; content:'\f073'; color: inherit } /* firefox 19+ */
input.date-picker:-ms-input-placeholder::before { font-family: fontAwesome; content:'\f073'; color: inherit } /* ie */
input.date-picker:-moz-placeholder::before { font-family: fontAwesome; content:'\f073'; color: inherit }
<div class="social">
<span class="twitter">
<a href="http://twitter.com/share" class="twitter-share-button" data-url="[your-url-here]">Tweet</a>
</span>
<span class="google">
<g:plusone size="medium" href="[your-url-here]"></g:plusone>
</span>
<span class="Facebook">
<iframe src="https://www.facebook.com/plugins/like.php?href=[your-url-here]&amp;show_faces=false&amp;layout=button_count" scrolling="no" frameborder="0" style="height: 21px; width: 100px" allowTransparency="true"></iframe>
</span>
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@turhn
turhn / karma.rake
Created December 8, 2014 13:23
Configuring a Rake Task for karma and jasmine
require 'open3'
namespace :karma do
task :start => :environment do
with_tmp_config :start
end
task :run => :environment do
with_tmp_config :start "--single-run"

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
root@vagrant-ubuntu-trusty-64:~# sh -x /etc/init.d/unicorn start
+ set -e
+ USAGE=Usage: /etc/init.d/unicorn <start|stop|restart|upgrade|rotate|force-stop>
+ USER=vagrant
+ APP_NAME=safir
+ APP_ROOT=/vagrant
+ RAILS_ENV=production
+ export RBENV_ROOT=/home/vagrant/.rbenv
+ export PATH=/home/vagrant/.rbenv/bin:/home/vagrant/.rbenv/shims:/home/vagrant/.rbenv/bin:/home/vagrant/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ SET_RUBY=cd /vagrant && rbenv rehash && rbenv local 2.2.0
@turhn
turhn / run_command_on_git_revisions.sh
Created January 21, 2015 02:40
run-command-on-git-revisions
#!/bin/bash
#
# This script runs a given command over a range of Git revisions. Note that it
# will check past revisions out! Exercise caution if there are important
# untracked files in your working tree.
#
# This came from Gary Bernhardt's dotfiles:
# https://github.com/garybernhardt/dotfiles
#
# Example usage: