Skip to content

Instantly share code, notes, and snippets.

View knibals's full-sized avatar

Oumar Fall knibals

View GitHub Profile
<?php
/**
* Implements hook_form_alter().
*
* Redirects user logins to the front page.
*/
function HOOK_form_user_login_alter(&$form, &$form_state) {
$form['#action'] = url('user', array('query' => array('destination' => '<front>')));
}
@knibals
knibals / gist:2491501
Created April 25, 2012 17:31 — forked from mrconnerton/gist:1979037
node form in ctools modal drupal 7
<?php
/**
* Implements hook_menu().
*/
function mymodule_menu() {
$items['mymodule/%ctools_js/add'] = array(
'page callback' => 'mymodule_node_add_modal_callback',
'page arguments' => array(1),
'access arguments' => array('access content'),
@knibals
knibals / drupal_jquery_from_cdn.php
Created October 23, 2012 13:00
Retrieve jQuery from CDN (hook_js_alter)
/**
* Implements hook_js_alter().
*/
function YOUR_THEME_js_alter(&$js) {
if (isset($js['misc/jquery.js'])) {
$jquery_path = 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js';
$js['misc/jquery.js']['data'] = $jquery_path;
$js['misc/jquery.js']['version'] = '1.8.0';
$js['misc/jquery.js']['type'] = 'external';
}
@knibals
knibals / Select theme by IP address
Created April 25, 2013 10:01
Select a specific theme by IP address (may be useful when THEMERS work collaboratively with DEV people)
<?php
/**
* @file helpers.module
*/
/**
* Implements hook_custom_theme().
* Activer le theme uniquement pour le themer (par adresse IP)
*/
@knibals
knibals / Youtube API sample with GO
Last active March 2, 2021 03:29 — forked from ikai/gist:1f746b018664f604e4cc
Code example for connection to Youtube API (written in Go -- #golang)
package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"net"
@knibals
knibals / Drupal menu theming: items level
Last active August 29, 2015 14:01 — forked from henrijs/gist:6225177
Ajouter une classe du niveau du menu dans l'UL pour theming
```php
function themename_menu_link(&$vars) {
$element = $vars['element'];
$sub_menu = '';
$element['#attributes']['data-menu-parent'] = array($element['#original_link']['menu_name'] . '-' . $element['#original_link']['depth']);
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
@knibals
knibals / keybase.md
Last active September 22, 2019 11:56

Keybase proof

I hereby claim:

  • I am knibals on github.
  • I am knibals (https://keybase.io/knibals) on keybase.
  • I have a public key ASAt-c3vDWMV9XL6kUSeazJZGL7IJPKY6MjhzstWpkJS6Ao

To claim this, I am signing this object:

@knibals
knibals / .gitignore
Last active August 29, 2015 14:22 — forked from mynameispj/.gitignore
Git Ignore SASS cache files
# Ignore docs files
styles/.sass-cache
styles/.sass-cache/*
To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use: git rm --cached filename
To untrack every file that is now in your .gitignore:
First commit any outstanding code changes, and then, run this command:
@knibals
knibals / GoWithC.go
Last active September 2, 2015 10:31 — forked from 17twenty/GoWithC.go
Cross Compiling and Language Interop oh my!
package main
import (
"./binding"
"fmt"
)
func main() {
binding.PrintHello()
binding.Seed(1)
fmt.Println(binding.Random())
Verifying that +knibals is my blockchain ID. https://onename.com/knibals