Skip to content

Instantly share code, notes, and snippets.

View hamedrnik's full-sized avatar

Hamed R. Nik hamedrnik

View GitHub Profile
@hamedrnik
hamedrnik / tweet_collector.rb
Created March 16, 2017 14:17
Collect tweets
require 'twitter'
client = Twitter::Streaming::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
end
# Collecting tweets from /sample endpoint
curl -X GET \
--header "Accept: application/json" \
--header "X-AYLIEN-TextAPI-Application-ID: YOUR_APP_ID" \
--header "X-AYLIEN-TextAPI-Application-Key: YOUR_API_KEY" \
"https://api.aylien.com/api/v1/absa/hotels?url=http://www.businessinsider.com/carl-icahn-open-letter-to-apple-2014-1"
swagger: '2.0'
info:
title: Example API
contact:
name: API support
url: https://example.com/
version: '1.0'
host: example.com
basePath: /api/v1
schemes:
window.json_s2 = {"stories":[{"id":15785247,"title":"10 takeaways from the Democratic convention","body":"Philadelphia (CNN) Hillary Clinton accepted the Democratic presidential nomination Thursday night, casting herself as a uniter working for the common good and Donald Trump as a divider stoking fear for political gain.\n\nIt capped a Democratic National Convention designed to tell a new story about the most famous woman in American politics.\n\nAnd it teed up the Democrats' frame for the election: Clinton's view of an optimistic, inclusive America (\"Stronger Together\") juxtaposed against Trump's vision of a country being ripped apart by terrorism, bad trade deals and a corrupt political system that he alone can save.\n\nHere are CNN's takeaways from four days in Philadelphia:\n\nClinton stepped onto the stage in a moment of intense emotion. She stopped to whisper in Chelsea Clinton's ear after her daughter offered a loving introduction. And she paused, appearing overwhelmed, as Rachel Platten's \"Fight S
import aylien_news_api
from aylien_news_api.rest import ApiException
from functools import reduce
# Configure API key authorization: app_id
aylien_news_api.configuration.api_key['X-AYLIEN-NewsAPI-Application-ID'] = 'YOUR_APP_ID'
# Configure API key authorization: app_key
aylien_news_api.configuration.api_key['X-AYLIEN-NewsAPI-Application-Key'] = 'YOUR_APP_KEY'
# create an instance of the API class
import aylien_news_api
from aylien_news_api.rest import ApiException
# Configure API key authorization: app_id
aylien_news_api.configuration.api_key['X-AYLIEN-NewsAPI-Application-ID'] = 'YOUR_APP_ID'
# Configure API key authorization: app_key
aylien_news_api.configuration.api_key['X-AYLIEN-NewsAPI-Application-Key'] = 'YOUR_APP_KEY'
# create an instance of the API class
api_instance = aylien_news_api.DefaultApi()
import aylien_news_api
from aylien_news_api.rest import ApiException
# Configure API key authorization: app_id
aylien_news_api.configuration.api_key['X-AYLIEN-NewsAPI-Application-ID'] = 'APP_ID'
# Configure API key authorization: app_key
aylien_news_api.configuration.api_key['X-AYLIEN-NewsAPI-Application-Key'] = 'APP_KEY'
# create an instance of the API class
api_instance = aylien_news_api.DefaultApi()
@hamedrnik
hamedrnik / 1dTo3d.java
Last active May 23, 2016 22:37
Convert 1D array into 3D
package com.example.converter;
import java.util.Arrays;
import java.util.regex.Matcher;
public class tset39 {
public static void main(String[] args) {
int width = 2;
int height = 2;
{
"intervals": [
{
"bin": 0,
"count": 39355
},
{
"bin": 1000,
"count": 623
},
# config/application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
if ["development", "production"].include? Rails.env