Skip to content

Instantly share code, notes, and snippets.

View kallefrombosnia's full-sized avatar
🎯
Focusing

Izet Mulalic kallefrombosnia

🎯
Focusing
View GitHub Profile
@jhoff
jhoff / Removable Laravel Routes.md
Last active July 31, 2023 03:42
Removable Laravel Routes

Removable Laravel Routes

This is a Laravel Router mixin that was originally written for a Laravel Spark app that allows you to remove previously defined routes that are hard coded in a package.

We no longer need it, but thought the code might be useful to someone so here it is

Disclaimer

This should not be used to modify the authentication routes that come with Laravel out if the box. There is a much easier way to do this. See the documentation and Stack Overflow for examples.

@vielhuber
vielhuber / script.php
Last active January 13, 2023 10:46
get current language (with locale) #wpml #wordpress
<?php
// returns 'en'
apply_filters( 'wpml_current_language', NULL );
// returns 'en'
global $sitepress;
$lang = $sitepress->get_current_language();
// returns 'en' (deprecated, does also not work when you switched languages programmatically)
if(defined('ICL_LANGUAGE_CODE')) {
@mikaoelitiana
mikaoelitiana / MyScreen.js
Created August 29, 2018 20:40
custom nav header with react-native-elements
import React, { Component } from 'react'
import { View, TextInput, Text } from 'react-native'
import { Header } from 'react-native-elements'
class MyScreen extends Component {
render () {
return (
<View>
<Header
leftComponent={{ icon: 'menu', color: '#fff' }}
@joshnuss
joshnuss / app.js
Last active March 4, 2024 00:01
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@Goles
Goles / CountryCodes.json
Created July 29, 2012 05:37
Country and Dial or Phone codes in JSON format
[{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375","
@mikedfunk
mikedfunk / gist:1370989
Created November 16, 2011 19:02
Using MySQL NOW() in Codeigniter
<?php
// Using MySQL NOW() in Codeigniter
// by daveganley
// There are two easy ways to do this
// With NOW()
$data = array(
'field_name' => 'some_data'
);