Skip to content

Instantly share code, notes, and snippets.

View adamdilek's full-sized avatar
🎯
focusing

Adam Dilek adamdilek

🎯
focusing
View GitHub Profile
@adamdilek
adamdilek / node.js
Created July 5, 2016 23:00 — forked from Roman2K/node.js
Ruby/node encryption/decryption
const crypto = require('crypto');
const PASSWORD = "098f6bcd4621d373cade4e832627b4f6"
, MESSAGE = 'test';
function InvalidSignatureError() {
Error.captureStackTrace(this, this.constructor);
}
function encipher(message, password, callback) {
@adamdilek
adamdilek / iterm2.md
Created July 3, 2016 10:03
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
Go to Split Pane by Order of Use + ] , + [
@adamdilek
adamdilek / gist:a948ec416b3502ff71b67ce7087643fd
Created June 10, 2016 10:24 — forked from clintongormley/gist:4095280
Using synonyms in Elasticsearch

We create an index with:

  • two filters: synonyms_expand and synonyms_contract
  • two analyzers: synonyms_expand and synonyms_contract
  • three text fields:
    • text_1 uses the synonyms_expand analyzer at index and search time
    • text_2 uses the synonyms_expand analyzer at index time, but the standard analyzer at search time
    • text_3 uses the synonyms_contract analyzer at index and search time

.

@adamdilek
adamdilek / script-score.sh
Created May 16, 2016 15:13 — forked from drewr/script-score.sh
Example of function_score using the script_score function. This achieves a result similar to creating a script field and then sorting descending by that dynamic value.
#!/bin/sh
curl -XDELETE localhost:9200/foo >/dev/null
curl -XPOST localhost:9200/foo/t -d'
{
"clicks": 10,
"impressions": 1000,
"when": "2013-10-01"
}
@adamdilek
adamdilek / ImageMagick-Amazon-Linux.md
Created April 12, 2016 06:48 — forked from ARolek/ImageMagick-Amazon-Linux.md
Install ImageMagick from source on Amazon Linux

I needed a newer version of ImageMagick than is available on the yum packages on Amazon Linux. I tried using the remi repo but it failed with dependency errors. Here is what I did to install ImageMagick with support for PNG, JPG, and TIFF.

download the most recent package

wget http://www.imagemagick.org/download/ImageMagick.tar.gz

uncomress the package

@adamdilek
adamdilek / README.md
Created April 1, 2016 17:29 — forked from fbaiodias/README.md
GraphQL circular dependencies

Circular dependencies on GraphQL schemas

Problem

Whenever I uncomment the lines on author.js I get the following error:

/Users/xicombd/Code/taskq/taskq-api/node_modules/graphql/jsutils/invariant.js:20
    throw new Error(message);
    ^
@adamdilek
adamdilek / 0_reuse_code.js
Last active August 29, 2015 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
sudo vi /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main # Bu satırı yukarıdaki dosyaya ekliyoruz
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - # evet sonunda tire işareti var
sudo apt-get update
sudo apt-get install postgresql-9.3
rescue_from Exception, :with => :server_error
def server_error(exception)
respond_to do |format|
format.html { render template: 'errors/internal_server_error', layout: 'layouts/application', status: 500 }
format.all { render nothing: true, status: 500}
end
end
rescue_from ActiveRecord::RecordNotFound, :with => :page_not_found
<form method="post" action="https://secure.payu.com.tr/order/lu.php">
<input type="hidden" name="MERCHANT" value="PAYUDEMO">
<input type="hidden" name="ORDER_REF" value="112457">
<input type="hidden" name="ORDER_DATE" value="2012-05-01 15:51:35">
<input type="hidden" name="ORDER_PNAME[]" value="MacBook Air 13 inç">
<input type="hidden" name="ORDER_PNAME[]" value="iPhone 4S">
<input type="hidden" name="ORDER_PCODE[]" value="MBA13">
<input type="hidden" name="ORDER_PCODE[]" value="IP4S">
<input type="hidden" name="ORDER_PINFO[]" value="Uzatılmış Garanti - 5 Yıl">
<input type="hidden" name="ORDER_PINFO[]" value="">