Skip to content

Instantly share code, notes, and snippets.

View jmoren's full-sized avatar

Jorge jmoren

  • Buenos Aires - Argentina
View GitHub Profile
ActiveAdmin.setup do |config|
# Don't enfoce mass assignment rules on the admin panel
config.before_filter do
params.permit!
end
# == Site Title
#
# Set the title that is displayed on the main layout
# for each of the active admin pages.
def stats
@ivr = Smrt::Ivr.find(params[:id])
@stats = @ivr.action_flows
@rules_by_containers = Smrt::IvrActionFlow.execute_query('SELECT container_name, name, SUM(case when rule_type = "invalid" then 1 else 0 end) AS invalid_rule, SUM(case when rule_type = "match" then 1 else 0 end) AS match_rule FROM ivr_dev.ivr_action_flows WHERE ivr_id = 2008 GROUP BY name;')
end
private function dispoBarHandler(evt:MenuEvent):void {
send_cmd_to_server('disconnect','unused');
Application.application.app.contactViewTab.kvDataGrid.editedItemPosition = null;
Application.application.app.contactViewTab.dispoBar.enabled = false;
Application.application.app.contactViewTab.btnAddNote.enabled = false;
Application.application.app.contactViewTab.kvDataGrid.editable = false;
switch(evt.item.selection) {
case 'markAsGoal':
var _log:Log = new Log;
_log.user = _user;
@jmoren
jmoren / gist:fc9fb880855f78a21324
Created October 8, 2014 19:13
Esta funcion es la que lee el archivo de configuracion
...
function checkConfig {
echo -e " * Chequeanado archivos de configuracion..."
if [ ! -f $CONFIGFILE ]; then
echo -e "\t> `basename $CONFIGFILE`\t \033[0;31mNO\033[m"
echo -e " * Debe ejecutar el script de instalacion para reparar la instalacion\n"
exit -1
else
echo -e "\t> `basename $CONFIGFILE`\t \033[0;32mSI\033[m"
echo " "
formatter.ini
NEW_LINE_FOR_BRACKET=0
SPACES_BEFORE_OPEN_BRACKET=0
SPACING=6
Progam:
program{
a := True;
formatter.ini
NEW_LINE_FOR_BRACKET=0
SPACES_BEFORE_OPEN_BRACKET=5
SPACING=10
Mismo programa
Resultado:
program
@jmoren
jmoren / kbtree
Created June 5, 2012 00:16
resutl
Linea : 6,1333504800,17,10,8,,
Data : 6,1333504800,17,10,8.
DEBUG: kbtree_leaf_insert(): inserted at position 0.
Linea : 3,1331793000,19,13,4,,
Data : 3,1331793000,19,13,4.
DEBUG: kbtree_leaf_insert(): inserted at position 1.
Linea : 5,1335126600,11,4,3,,
Data : 5,1335126600,11,4,3.
DEBUG: kbtree_leaf_insert(): inserted at position 2.
Linea : 4,1328477400,10,7,3,,
@jmoren
jmoren / test csv
Created June 8, 2012 13:42
BackgrounRb
MiddleMan.worker(:fast_import_worker)
=> #<BackgrounDRb::RailsWorkerProxy:0x3b6d9a8 @worker_key=nil, @middle_man=#<BackgrounDRb::ClusterConnection:0x32b84e8 @request_count=1, @bdrb_servers=[#<struct #<Class:0x32a7ff8> ip="0.0.0.0", port=11006>], @round_robin=[0], @last_polled_time=Fri Jun 08 06:25:06 -0700 2012, @disconnected_connections={}, @backend_connections=[#<BackgrounDRb::Connection:0x32a7b98 @mutex=#<Mutex:0x32a7b48>, @server_ip="0.0.0.0", @connection_status=true, @cluster_conn=#<BackgrounDRb::ClusterConnection:0x32b84e8 ...>, @server_port=11006>]>, @worker_name=:fast_import_worker, @tried_connections=[]>
>> MiddleMan.worker(:fast_import_worker).csv_local
=> "dummy_result"
>> MiddleMan.worker(:fast_import_worker).async_csv_local
=> nil
>> MiddleMan.worker(:fast_import_worker).async_csv_local(:arg => {:import_type => 7, :list_name => "probando" })
=> nil
>> MiddleMan.worker(:fast_import_worker).csv_local(:arg => {:import_type => 7, :list_name => "probando" })
=> "dummy_result"
@jmoren
jmoren / local_csv.rb
Created June 13, 2012 14:21
modificaciones csv
#@sql = "LOAD DATA LOCAL INFILE '/tmp/hh_import_#{@user.id}#{rand_filename}.tsv' INTO TABLE contacts (phone) SET user_id=#{@user.id},status=#{import_type},import=1,created_at=UTC_TIMESTAMP(),updated_at=UTC_TIMESTAMP()"
#ActiveRecord::Base.connection.execute(@sql) if @exists_phones.length > 0 #.join adds a \n to empty arrays
@contacts = Contact.create(
@exists_phones.map{|phone| {:phone => phone, :status => import_type, :user_id => @user.id, :import => 1} }
)
ids = @contacts.map(&:id)
@q_contacts = QcallContact.create(
ids.map{|contact_id| {:qcall_contact_list_id => @q_new_list.id, :qpriority => 10, :qcall_id => @qcall.id, :contact_id => contact_id } }
# Esto hizo tonchis hasta ahora.
private var edited_row_index:int;
private function editCell(event:AdvancedDataGridEvent):void{
edited_row_index = event.rowIndex;
ExternalInterface.call('console.log', "Event" + event);
}
private function putNewValue(event:AdvancedDataGridEvent):void{