Skip to content

Instantly share code, notes, and snippets.

View cesswairimu's full-sized avatar
👩‍💻
Coding

Cess cesswairimu

👩‍💻
Coding
View GitHub Profile
@cesswairimu
cesswairimu / counties.rb
Created April 2, 2024 22:50
Kenya County Lists
COUNTIES = { 'Mombasa' => { code: '001', abbrv: 'MSA', capital: "Mombasa", province: 'Coast' },
'Kwale' => { code: '002', abbrv: 'KWL', capital: 'Kwale', province: 'Coast' },
'Kilifi' => { code: '003', abbrv: 'KLF', capital: 'Kilifi', province: 'Coast' },
'Tana River' => { code: '004', abbrv: 'TRV', capital: 'Hola', province: 'Coast' },
'Lamu' => { code: '005', abbrv: 'LMU', capital: 'Lamu', province: 'Coast' },
'Taita Taveta' => { code: '006', abbrv: 'TVT', capital: 'Wundanyi', province: 'Coast' },
'Garissa' => { code: '007', abbrv: 'GRS', capital: 'Garissa', province: 'North Eastern' },
'Wajir' => { code: '008', abbrv: 'WJR', capital: 'Wajir', province: 'North Eastern' },
'Mandera' => { code: '009', abbrv: 'MDR', capital: 'Mandera', province: 'North Eastern' },
'Marsabit'
with new_table as (
select crt.id,
crt.gross_amount/((100+tax.tax_default_percentage)/100) as net_amount,
crt.gross_amount - (crt.gross_amount/((100+tax.tax_default_percentage)/100)) as tax_amount,
tax.tax_default_percentage as tax_rate
from customer_return_items crt
inner join customer_returns cr on cr.id = crt.customer_return_id
inner join warehouses w on w.id = cr.warehouse_id
(Request number 1)I looked and saw that this is happeninG) I can see the comments and likes on the news feeds page..let me know if you understand what he meant.
(Request number 2)The friendship request to current_user happens after creation and nagivating to `/users` changing the
`@not_friends`
method in users_controller to "@not_friends = User.where.not(
id: (@confirmed_friends.map(&:id) + @pending_friends.map(&:id))).reject{ |user| user == current_user }" should solve this
(Request number 3) On line 33 of users index view add another button <%= button_to "Reject Friend",{:controller => 'friendships', :action => 'destroy' :id => friendship.id }, {:method => :patch, :class => "bg-red font-white p-1 acceptingfriend"} %>
The friendship request to current_user happens after creation and nagivating to `/users` changingthe `@not_friends` method
to
`@not_friends = User.where.not(id: current_user.friendships.map(&:friend_id)).reject{|user| user == current_user})`
<div class="like-buttons d-print-none btn-toolbar mb-3">
<% if logged_in_as(['admin', 'moderator']) || (current_user && (current_user.uid == node.uid || node.has_tag("with:#{current_user.username}"))) %>
<% if node.type == 'note' %>
<a <% if current_user && current_user.uid != node.uid %>data-confirm='Please be aware that you are editing a post by another contributor, a privilege you have only because you are an admin or co-author.' <% end %> class='btn btn-outline-secondary btn-circle btn-sm' href='/notes/edit/<%= node.id %>?t=<%= Time.now.to_i %><% if params[:controller] == "questions" %>&redirect=question&template=question<% end %>'>
<i class='ml-1 ff fa fa-pencil'></i>
</a>
<% end %>
<% end %>
<span data-toggle="tooltip" data-placement="top" rel="tooltip" title="Liked by <%= node.likers.length %> people" class="btn btn-outline-secondary btn-circle btn-like" node-id="<%= node.id %>" id="like-button-<%= node.id %>">
// trying to use this function to plot my values
helpful link => https://codepen.io/apexcharts/pen/QrbEQg
function generateDayWiseTimeSeries(s, count) {
var values = [[
<%= @graph_notes.values.collect {|ind| ind[1]} %>,
<%= @graph_wikis.values.collect {|ind| ind[1]} %>,
<%= @graph_comments.values.collect {|ind| ind[1]} %>
]];
@cesswairimu
cesswairimu / gist:f68cf742ea5b921f8a90d78be32aab48
Created March 29, 2018 08:21
Error when running `bundle exec passenger start`
=============== Phusion Passenger Standalone web server started ===============
PID file: /home/cessito/code/plots2/passenger.3000.pid
Log file: /home/cessito/code/plots2/log/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/
You can stop Phusion Passenger Standalone by pressing Ctrl-C.
Problems? Check https://www.phusionpassenger.com/library/admin/standalone/troubleshooting/
===============================================================================
App 812 stdout:
@cesswairimu
cesswairimu / Error when running 'rake db:migrate`
Created January 13, 2018 15:51
SQLite3::SQLException: near "ENGINE": syntax error
-- create_table("comments", {:primary_key=>"cid", :options=>"ENGINE=MyISAM"})
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: near "ENGINE": syntax error: CREATE TABLE "comments" ("cid" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "pid" integer DEFAULT 0 NOT NULL, "nid" integer DEFAULT 0 NOT NULL, "uid" integer DEFAULT 0 NOT NULL, "subject" varchar(64) DEFAULT '' NOT NULL, "comment" text(2147483647) NOT NULL, "hostname" varchar(128) DEFAULT '' NOT NULL, "timestamp" integer DEFAULT 0 NOT NULL, "status" integer(1) DEFAULT 0 NOT NULL, "format" integer(2) DEFAULT 0 NOT NULL, "thread" varchar(255) NOT NULL, "name" varchar(60), "mail" varchar(64), "homepage" varchar(255)) ENGINE=MyISAM/home/cessito/.rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in `initialize'
/home/cessito/.rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in `new'
/home/cessito/.rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:9