Skip to content

Instantly share code, notes, and snippets.

View ismk's full-sized avatar

Ismail Kalimi ismk

View GitHub Profile
@ismk
ismk / .treehouse
Created April 7, 2024 06:03 — forked from ErikGartner/.treehouse
dTree Demo
1.3.1
@ismk
ismk / rails http status codes
Created November 16, 2023 17:08 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@ismk
ismk / macos.md
Created March 30, 2023 16:14 — forked from sickcodes/macos.md
MacOS Defaults
# Forked from https://gist.github.com/gguerini
# Syntax edits by Sick Codes (GPLv3+)

# Disable menu bar transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false

# Show remaining battery time; hide percentage
defaults write com.apple.menuextra.battery ShowPercent -string "NO"
defaults write com.apple.menuextra.battery ShowTime -string "YES"

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@ismk
ismk / osx_setup.md
Created October 10, 2019 03:09 — forked from millermedeiros/osx_setup.md
Mac OS X setup

Setup Mac OS X

Edit: I've done the same process every couple years since 2013 (Mountain Lion, Mavericks and High Sierra).

I just replaced the hard drive of my mbp and decided to do a clean install of Mountain Lion (10.8.5) since I was still using Snow Leopard (10.6.8).

I kinda regret for not using Boxen to automate the process, but TBH I have this laptop for almost 3yrs and this is the first

@ismk
ismk / NokogiriXPathNamespaces
Created July 31, 2018 22:23 — forked from Ameeda/NokogiriXPathNamespaces
Selecting elements in some namespace using Nokogiri with XPath
2 ways to extract elements from within XML namespaces using Nokogiri
When trying to select elemenets in the default namespace, e.g. "xmlns= http://www.w3.org/2005/Atom", try the following two ways. Note the xmlns=" attribute on entry element:
Original xml:
Nokogiri::XML(@xml_string).xpath("//author/name").each do |node|
puts node
end
1. Define a namespace context for your XPath expression and point your XPath steps to match elements in that namespace. Define a namespace-to-prefix mapping and use this prefix (a) in the XPath expression.
@ismk
ismk / tournamentDBHelper.java
Created March 10, 2017 20:20
tournament db helper class
public Tournament getOngoingTournament() {
Tournament tournament = null;
SQLiteDatabase db = this.getReadableDatabase();
String sql = "SELECT "
+ COLUMN_TOURNAMENT_ID + ","
+ COLUMN_STATUS + ","
+ COLUMN_FIRST_USER + ","
+ COLUMN_FIRST_PRIZE + ","
+ COLUMN_SECOND_USER + ","
@ismk
ismk / Calculating_Sequence.rb
Created December 17, 2015 05:01
Sequence Solution
# Okay lets first implement the base cases and then we can tackle higher numbers
# First we need to have the condition thats stops the sequence, i.e when n is 1
while(n != 1) do
# the sequence here
end
# Now for the rules to be implemented
# n → n/2 (n is even)
# n → 3n + 1 (n is odd)
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'