Skip to content

Instantly share code, notes, and snippets.

View almokhtarbr's full-sized avatar
👋

almokhtar almokhtarbr

👋
  • 11:24 (UTC -04:00)
View GitHub Profile
@tahirm
tahirm / xdebug.sh
Created April 18, 2014 19:42
Install/uninstall xdebug from pecl. #xdebug #apache2 Further notes for installing xdebug on ubuntu. http://ubuntuforums.org/showthread.php?t=525257
# install xdebug using pecl
$ sudo pecl install xdebug
# uninstall xdebug using pecl
$ sudo pecl uninstall xdebug
@paulund
paulund / automatically-set-application-locale.php
Last active March 27, 2019 15:04
Automatically Detect Browser Language With PHP
<?php
$supportedLangs = array('en-GB', 'fr', 'de');
$languages = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach($languages as $lang)
{
if(in_array($lang, $supportedLangs))
{
@KevinBatdorf
KevinBatdorf / ThemosisValetDriverOld.php
Last active December 2, 2019 16:27
Laravel Valet driver for Themosis v1.3
<?php
class ThemosisValetDriverOld extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@ramon-villain
ramon-villain / ThemosisValetDriver.php
Last active July 31, 2020 21:09
Themosis 1.3 Valet Driver
<?php
class ThemosisValetDriver extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@aflansburg
aflansburg / user-actions.rb
Last active September 9, 2020 21:22
simple ruby console app example - user auth
# simple user class
class User
def initialize(user_name, password)
@user_name = user_name
@password = password
end
attr_accessor :user_name
attr_accessor :password
end
@bibendi
bibendi / tgnotify
Last active September 16, 2020 22:36
Ruby CLI tool for sending notifications to Telegram
#!/usr/bin/env ruby
require 'optparse'
options = {}
opt_parser = OptionParser.new do |opt|
opt.banner = 'Usage: tgnotify [OPTIONS] text'
opt.separator ''
opt.separator 'CLI tool for sending notifications to Telegram'
@DoktahWorm
DoktahWorm / gist:1062992
Created July 4, 2011 06:52
irb db sample
irb
require 'rubygems'
require 'mysql'
db_conn = Mysql.connect('hostname', 'username', 'password', 'database')
# Get an array of all the dbs and then iterate through them
dbs = db_conn.list_dbs.each do |db|
# print the name of the db
puts "db: #{ db }"
@sammyhenningsson
sammyhenningsson / shaf-form.md
Last active October 11, 2020 19:00
Specification of the shaf-form media type profile

The shaf-form media type profile

This profile describes how a set of descriptors should be interpreted to turn a generic media type into a form (similar to HTML forms). For example, the HAL media type (application/hal+json) does not specify any semantics about forms, however we can add semantics about forms to a HAL document but providing a profile.

shaf-form descriptors

  • method: The HTTP method used for submitting the form.
  • href: The target uri that the form should be submitted to.
  • name: A string used to indentify the form.
  • title: A string used as title/label when showing the form in a user interface.
@sammyhenningsson
sammyhenningsson / shaf-error.md
Last active October 11, 2020 19:01
Specification of the shaf-error media type profile

The shaf-error media type profile

This profile describes a set of descriptors for generic error messages.

shaf-error descriptors

  • code: An identifier that describes the type of error.
  • title: A short string used for labeling the error.
  • message: A description with details about the error.
  • fields: An object with validation errors

Fields

@juanmaree
juanmaree / cheat_sheet.rb
Created September 17, 2018 15:27
[Ruby Cheat] Cheatsheet #ruby
# This is a comment
# In Ruby, (almost) everything is an object.
# This includes numbers...
3.class #=> Integer
# ...and strings...
"Hello".class #=> String
# ...and even methods!