Skip to content

Instantly share code, notes, and snippets.

View jb41's full-sized avatar

Michal Oblak jb41

View GitHub Profile
@jb41
jb41 / gist:6994772
Created October 15, 2013 16:52
Stock market predictions
0 12877.296400401341 12861.47 -1 -1 GOOD
1 12999.117936246008 13090.86 -1 -1 GOOD
2 13370.37869004279 13322.13 -1 -1 GOOD
3 13278.814631659323 13357.74 1 1 GOOD
4 13132.707484751954 13113.38 -1 -1 GOOD
5 13384.730797208525 13424.88 1 1 GOOD
6 13790.953079736471 13815.56 1 1 GOOD
7 13798.868947637924 13778.65 1 1 GOOD
8 14081.91496746652 14087.55 1 1 GOOD
9 14040.95736980952 14066.01 1 1 GOOD
@jb41
jb41 / simple_form_boostrap.rb
Created January 25, 2014 16:47
simple_form_boostrap.rb modyfication
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
<input type="hidden" value="" type="text" id="timestamp">
<script>
document.getElementById("timestamp").value = Date.now()
</script>
@jb41
jb41 / transfer_users_to_spreadsheet.rb
Last active September 25, 2015 20:42
Exporting Users table from Rails to Sheetsu
class TransferUsersToSpreadsheet
# Link to your
SHEETSU_API_URL = "put link to your API (from sheetsu.com) here"
# Fields to import
FIELDS_TO_IMPORT = [
'id', 'email', 'remember_created_at', 'sign_in_count', 'last_sign_in_at', 'name',
'slug', 'role', 'created_at', 'gender', 'age_range', 'birthday', 'location'
]
@jb41
jb41 / form.html
Last active January 30, 2016 23:16
POST data to Google Spreadsheet via Sheetsu API (jQuery, simple demo)
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<form id="form">
<input type="text" name="id">
<input type="text" name="email">
GET /
[
{ id: '1', name: 'Peter', score: '43' },
{ id: '2', name: 'Lois', score: '89' },
{ id: '3', name: 'Meg', score: '10' },
{ id: '4', name: 'Chris', score: '43' },
{ id: '5', name: 'Stewie', score: '72' }
]
GET /?fields="id,name"
[
@jb41
jb41 / home_ctrl.js.coffee
Created December 1, 2015 01:21
Playing with that using Sheetsu and AngularJS
angular.module('sheetsu').controller 'HomeCtrl', [
'$scope',
'Subjucator',
($scope, Subjucator) ->
$scope.emailSubscribed = false
$scope.useCaseSent = ''
$scope.useCases = {}
currentDate = ->
def fizzbuzz(number)
return "FizzBuzz" if is_divisible_by_fifteen?(number)
return "Buzz" if is_divisible_by_five?(number)
return "Fizz" if is_divisible_by_three?(number)
number
end
def is_divisible_by_three?(number)
is_divisible_by(number, 3)
end
require 'json'
require 'httparty'
def add_email_to_spreadsheet(email)
HTTParty.post(
'https://sheetsu.com/apis/v1.0/c12aec61',
body: { email: email }.to_json,
headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}
).body
end
require 'json'
require 'httparty'
def add_email_to_spreadsheet(email)
HTTParty.post(
'https://sheetsu.com/apis/v1.0/c12aec61',
body: { email: email }.to_json,
headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}
).body
end