Skip to content

Instantly share code, notes, and snippets.

View piouPiouM's full-sized avatar
🪄
Tweaking my Neovim configuration

Mehdi Kabab piouPiouM

🪄
Tweaking my Neovim configuration
View GitHub Profile
@piouPiouM
piouPiouM / Convert Selection to Unicode.tmCommand
Created July 31, 2009 12:00
TextMate "Convert Selection to Unicode" command for the CSS bundle.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>bundleUUID</key>
<string>4675F24E-6227-11D9-BFB1-000D93589AF6</string>
<key>command</key>
<string>#!/usr/bin/env ruby -wKU
@piouPiouM
piouPiouM / wp-get_post_images.php
Created September 14, 2009 00:25
WordPress fonction for retrieve list of images from a post
<?php
/**
* Retrieve list of images from a post.
*
* The defaults are as follows:
* 'number' - Default is -1. Total number of images to retrieve.
* 'order' - Default is 'ASC'. The order to retrieve the attachments.
* 'orderby' - Default is 'post_date'. How to order the posts.
* Uses 'natural' to retrieve the images in the order they appear in the post.
* 'output' - Default is OBJECT. Constant for return type, either OBJECT, ARRAY_A, ARRAY_N.
@piouPiouM
piouPiouM / gist:198866
Created October 1, 2009 09:46
Pourquoi faire simple quand on peut faire compliqué ?
--- class.phpmailer.php
+++ (clipboard)
@@ -323,9 +323,7 @@
* @return void
*/
public function AddAddress($address, $name = '') {
- $cur = count($this->to);
- $this->to[$cur][0] = trim($address);
- $this->to[$cur][1] = $name;
+ $this->to[] = array(trim($address), $name);
Singular
issue 2
issue 11
bug 2
ticket 2
#2
issue #2
foo #2
#!/usr/bin/env ruby
require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes"
# Converts a HTML color string to a RGB colors string.
#
# hex_to_css("#6633ff") # => rgb(102, 51, 255)
# hex_to_css("#63f") # => rgb(102, 51, 255)
# hex_to_css("#6633ff80") # => rgba(102, 51, 255, .50)
# hex_to_css("#63FA") # => rgba(102, 51, 255, .67)
<?php
/**
* Reverse a CamelCase string.
*
* Examples:
* uncamel('lowerCamelCase') === 'lower_camel_case'
* uncamel('UpperCamelCase') === 'upper_camel_case'
* uncamel('ThisIsAString') === 'this_is_a_string'
* uncamel('notcamelcase') === 'notcamelcase'
* uncamel('lowerCamelCase', ' | ') === 'lower | camel | case'
#!/usr/bin/env bash
# string_to_int.sh - Shell script to convert a string or float number
# to an integer.
# @link http://pioupioum.fr/snippets/bash-convertir-string-to-integer.html
function string_to_int ()
{
LANG=C
d=${1##*.}
if [[ ${#1} -eq ${#d} ]]; then
# Redirect all files are not in /foo/bar/blog to http//example.com/
RewriteEngine On
RewriteBase /foo/bar/
RewriteCond %{REQUEST_URI} !blog/?.*
RewriteRule ^(.*)$ http://example.com/ [R=301,L]
@piouPiouM
piouPiouM / hex2rgba.rb
Created April 15, 2010 07:52
Source code of a TextMate Command
#!/usr/bin/env ruby
#
# Convert a hex color into an RGB(A) color.
#
# Copyright (C) 2010 Mehdi Kabab <http://pioupioum.fr/>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
defaults read "/Library/Frameworks/Adobe AIR.framework/Versions/Current/Resources/Info" CFBundleVersion
OU
plutil -convert xml1 -o - "/Library/Frameworks/Adobe AIR.framework/Versions/Current/Resources/Info.plist" | grep -A 1 CFBundleVersion