- https://sidravic.github.io https://gitlab.com/sidravic
- @sidravic
- https://www.core27.co/post/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'eventmachine' | |
require 'socket' | |
require 'json' | |
require 'hashie' | |
require File.expand_path("twitter_lib.rb", __FILE__ + "/..") | |
require File.expand_path("tweet_Fetcher.rb", __FILE__ + "/..") | |
class Echo < EM::Connection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="timer-status"> </div> | |
<script> | |
$(document).ready(function(){ | |
timer = function(){ | |
var self = this; | |
var _timer_count = 0; | |
var timer_id = null; | |
self.startTimer = function(callback){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
posts.tags.first.name # business money finance investment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'daemons' | |
gem 'mailman', require: false | |
gem 'maildir' | |
gem 'mail' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"http" | |
"io/ioutil" | |
"os" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will parse your JSON | |
type APIResponse struct{ | |
StatusCode string `json:"status_code"` | |
OperationStatus bool `json:"status"` | |
Errors string `json:"error_messages, omitempty"` | |
ApplicationID string `json:"application_id, omitempty"` | |
QueueID int64 `json:"queue_id, omitempty"` | |
} | |
// 1 hour later I realized this won't return parsed values but defaults for the data types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Guide | |
# Configure the essential configurations below and do the following: | |
# | |
# Repository Creation: | |
# cap deploy:repository:create | |
# git add . | |
# git commit -am "initial commit" | |
# git push origin master | |
# | |
# Initial Deployment: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kaminari.paginate_array([{:a => 1}, {:b => 2}, {:c => 3}, {:d => 4}]).page(1).per(1) | |
=> [{:a=>1}] | |
[10] pry(main)> Kaminari.paginate_array([{:a => [1,2,3,4]}, {:b => [123,123,1231,231]}, {:c => [123123]}, {:d => [:asd, :asdasd]}]).page(1).per(1) | |
=> [{:a=>[1, 2, 3, 4]}] | |
[11] pry(main)> Kaminari.paginate_array([{:a => [1,2,3,4]}, {:b => [123,123,1231,231]}, {:c => [123123]}, {:d => [:asd, :asdasd]}]).page(1).per(2) | |
=> [{:a=>[1, 2, 3, 4]}, {:b=>[123, 123, 1231, 231]}] | |
[12] pry(main)> Kaminari.paginate_array([{:a => [1,2,3,4]}, {:b => [123,123,1231,231]}, {:c => [123123]}, {:d => [:asd, :asdasd]}]).page(1).per(3) | |
=> [{:a=>[1, 2, 3, 4]}, {:b=>[123, 123, 1231, 231]}, {:c=>[123123]}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "fileutils" | |
puts "Using system RVM" | |
#system("/bin/bash --login && rvm use system") | |
puts "Initializing PID and Log files" | |
PIDFOLDER = "/opt/pids" | |
PIDFILE = "/opt/pids/torquebox.pid" | |
LOGFILE = "/var/log/torquebox/torquebox.log" | |
FileUtils.mkdir_p(PIDFOLDER) unless Dir.exists?(PIDFILE) |
OlderNewer