Skip to content

Instantly share code, notes, and snippets.

View lipchyk's full-sized avatar
🏠
Working from home

Siarhei Lipchyk lipchyk

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am yspro on github.
  • I am yspro (https://keybase.io/yspro) on keybase.
  • I have a public key ASDlBjBkQf2lJ6xZzqVE-h-skz46W2HVb11RSKOHAIFcOAo

To claim this, I am signing this object:

@lipchyk
lipchyk / 0_reuse_code.js
Created February 8, 2017 12:18
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
if fork
puts 'YES'
else
puts 'NO'
end
module Luhn
extend self
def valid_cc?(num)
sum(num) % 10 == 0
end
def string_with_check_number(string)
sum = sum(string, true)
"#{string}#{check_digit(sum)}"
{
"domain":{
"dominder_api_response_code":3,
"registrar_info":{
"registrar":"GoDaddy.com, LLC (http://www.godaddy.com)",
"created_date":"2011-04-20",
"expiration_date":"2013-04-20",
"updated_date":"2011-06-06",
"status":"clientRenewProhibited"
},
<?xml version="1.0" encoding="UTF-8"?>
<domain>
<dominder-api-response-code type="integer">3</dominder-api-response-code>
<registrar-info>
<registrar>GoDaddy.com, LLC (http://www.godaddy.com)</registrar>
<created-date>2011-04-20</created-date>
<expiration-date>2013-04-20</expiration-date>
<updated-date>2011-06-06</updated-date>
<status>clientRenewProhibited</status>
</registrar-info>
require 'net/http'
http = Net::HTTP.new('api.dominder.com')
domain = 'google.com'
email = 'your_email@your-email-server.com'
authKey = 'your-authKey'
format = 'xml'
response = http.start do |http|
request = Net::HTTP::Get.new("/v1/#{domain}?format=#{format}")
request.basic_auth email, authKey
<?php
$email = 'your_email@your-email-server.com';
$authKey = 'your-authKey';
$domain = 'google.com';
$api_url = 'http://api.dominder.com/v1/';
$format = 'xml';
$client = curl_init($api_url . $domain . '?format=' . $format);
curl_setopt($client, CURLOPT_USERPWD, $email . ':' . $authKey);
curl_setopt($client, CURLOPT_TIMEOUT, 30);
@lipchyk
lipchyk / resque.rb
Created October 3, 2011 14:20
My resque.rb initializer for Rails 3.x app (using resque, resque-retry, resque-scheduler)
require 'resque' # include resque so we can configure it
require 'yaml'
require 'resque/failure/redis'
require 'resque/failure/multiple'
require 'resque/plugins/retry'
require "resque-retry"
Resque::Failure::MultipleWithRetrySuppression.classes = [Resque::Failure::Redis]
Resque::Failure.backend = Resque::Failure::MultipleWithRetrySuppression
Resque.redis = Redis.new(:host => 'localhost', :port => 6379)
curl --user 'username':'password' -o ~/delicious.xml 'https://api.del.icio.us/v1/posts/all'