Skip to content

Instantly share code, notes, and snippets.

Avatar

Miša Mаkaröv micmmakarov

View GitHub Profile
View Twilio Api
require 'pry'
require 'pry-nav'
#CODE IS "RailsSchoolDevelop14"
phones = {
michael: '+1415PUTREALNUMBER'
}
require 'twilio-ruby'
@micmmakarov
micmmakarov / magic-input.jsx.js.coffee
Last active Aug 29, 2015
Magic input for reactJS, supporting deep path binding
View magic-input.jsx.js.coffee
MagicInput = React.createClass
onChange: (e) ->
state = @props.binding[0].state
Sonar.changeByArray state, @path, e.target.value
@props.binding[0].setState state
getValue: ->
value = @props.binding[0].state
@path ||= @props.binding[1].split('.')
@micmmakarov
micmmakarov / helper.coffee
Last active Aug 29, 2015
Recursive function to change hash by deep_path
View helper.coffee
Sonar.changeByArray = (hash, array, newValue) ->
obj = hash
i = 0
while i < array.length - 1
obj = obj[array[i++]]
obj[array[i]] = newValue
@micmmakarov
micmmakarov / twitter_api
Created Aug 15, 2012
Find random tweet and then translate it to italian and repost
View twitter_api
require 'twitter'
require 'google_translate'
# We using credentials of "Rails School" twitter account
Twitter.configure do |config|
# credentials here!
end
# for translator
View seed_generator
def new_lined(text)
13.chr + 10.chr + text + 13.chr + 10.chr
end
posts = Post.all
posts.each do |p|
puts "Post.create(:title => '#{p.title}', :posted_on => '#{p.posted_on}' :author_id => '#{p.author_id}', :created_at => '#{p.created_at}', :updated_at => '#{p.updated_at}', :body => <<EOF"+new_lined(p.body)+"EOF)"
end
@micmmakarov
micmmakarov / 4sq.rb
Created Sep 5, 2012
Foursquare API using
View 4sq.rb
require 'foursquare2'
require 'pry'
require 'pry-nav'
require 'colorize'
client = Foursquare2::Client.new(:client_id => 'the key', :client_secret => 'the key')
@micmmakarov
micmmakarov / Get likes
Created Nov 11, 2015
Analyze person's likes to figure out who's the most active
View Get likes
api_key = "https://developers.facebook.com/tools/explorer"
api = Koala::Facebook::API.new(api_key)
profile = api.get_object("me")
profile = _
profile.keys
View gist:4720165
require "spec_helper"
puts "Hello, world!"
feature %q{
As a user
I want to be able to create
New Meetings
} do
View Test
require 'spec_helper'
require 'pry'
require 'pry-nav'
include Warden::Test::Helpers
feature 'Propack Order', :js => true do
background do
user = Factory.create(:user)
login_as(user, :scope => :user)
View Keen Event Data
{
message:{
id:1,
direction:"sent",
via_api:false,
type:"FacebookMessage"
},
customer:{
id:16
},