Skip to content

Instantly share code, notes, and snippets.

View dianjuar's full-sized avatar

Diego Julião dianjuar

  • Medellín - Colombia
  • 09:53 (UTC -05:00)
  • X @dianjuar
View GitHub Profile
@dianjuar
dianjuar / Copy the remaining files that are not copied form at all.py
Last active May 20, 2016 15:25
Imagine a huge amount of files, you copy some of then to do something, then you want the files left. This code in python copy the files that are not copied yet that all. You need to generate a list of the copied files, you can do it with `ls > copied.txt`. At the end this script will generate a list with the remaining files
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
def loadVectorFromFile( archiveName ):
vector = []
with open( archiveName, "r") as archive:
for line in archive:
vector.append(line)
@dianjuar
dianjuar / compile_OpenCV.sh
Last active July 27, 2016 14:16
How to compilte OpenCV with g++
g++ m.cpp -o app `pkg-config --cflags --libs opencv`
@dianjuar
dianjuar / Simple PHP Variable Printing with Structure.md
Last active October 2, 2016 20:05
Simple PHP Variable Printing with Structure
<?php
print( '<pre>'.print_r($var,true).'</pre>' );

Written with StackEdit.

@dianjuar
dianjuar / wp_has_user_role.md
Last active November 11, 2016 01:38
In Wordpress, if the current user has a determined role

Wordpress

If the current user has a determined role

$current_user = wp_get_current_user();
$isStudent    = in_array( 'student_role' , $current_user->roles);
@dianjuar
dianjuar / Preferences.sublime-settings
Last active December 5, 2016 23:59
Personal general settings of sublime text
{
"always_show_minimap_viewport": true,
"color_scheme": "Packages/User/SublimeLinter/Agila Oceanic Next (SL).tmTheme",
"dictionary": "Packages/Language - English/en_US.dic",
"font_size": 12,
"gutter": true,
"ignored_packages":
[
"Vintage"
],
@dianjuar
dianjuar / Create Symbolic links using find command.md
Last active February 10, 2017 01:12
Create symbolic links to all files located using `find` command
@dianjuar
dianjuar / comunite python with nodejs asynchronous.js
Last active March 2, 2017 03:18
Comunicate python process with asyncronush calls with nodejs
var spawn = require('child_process').spawn,
ls = spawn('python',['-u','python.py']);
ls.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
ls.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
@dianjuar
dianjuar / ajax_example.js
Last active March 4, 2017 06:01
A simple WP plugin to know how AJAX works on WordPress
/**
* @param {string} security_nonce
* Code of the Nonce. Security Stuff
*/
jQuery(function($)
{
// The call trigered
$('#publish').click(function(event)
{
@dianjuar
dianjuar / WP_ajax_js_.sublime-snippet
Last active March 4, 2017 06:10
SublimeText Snipets to create a template to make an AJAX request in WordPress
<snippet>
<content><![CDATA[
/**
* @param {string} security_nonce
* Code of the Nonce. Security Stuff
*/
jQuery(function(\$)
{
// The call trigered
@dianjuar
dianjuar / How to enqueue Scripts in WordPress, the right way.md
Last active May 7, 2017 23:34
How to enqueue Scipts in WordPress, the rigth way

When you want to enqueue a script in WordPress you need the URL of the JS or CSS!.

To accomplish that, the best way is to use a constant that have the URL of your plugin

if ( !defined( 'XXXXXX_PLUGIN_URL' ) )
	define( 'XXXXXX_PLUGIN_URL', plugin_dir_url( __FILE__ ) );