Skip to content

Instantly share code, notes, and snippets.

View raphaelchaib's full-sized avatar

Raphael Chaib raphaelchaib

View GitHub Profile
@billjohnston
billjohnston / setup.txt
Last active November 22, 2015 02:07
Amazon ec2 Server Setup
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
UPDATE:
I used 'sudo tasksel install lamp-server' instead of 'sudo tasksel' (then selecting) to stop the SSH problems I've been having with ubuntu 12.04
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Create a amazon aws account (http://aws.amazon.com) and enter the AWS management dashboard (https://console.aws.amazon.com/ec2/home). Select the EC2 tab at the top of the dashboard.
1) Create a Security Group that allows HTTP connections and limited SSH to configure the instance. Click on Security Groups > Create Security Group
- Name: web_access
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@adzenith
adzenith / Default (OSX).sublime-mousemap
Created June 23, 2012 19:28
Sublime Text 2 better mouse handling
[
// Basic drag select
{
"button": "button1", "count": 1,
"press_command": "drag_select_callback"
},
{
// Select between selection and click location
"button": "button1", "modifiers": ["shift"],
"press_command": "drag_select_callback",

###Init

  1. Spawn Ubuntu instance.
  2. Update aptitude with sudo apt-get update
  3. Install junk we want sudo apt-get install nginx spawn-fcgi php5 php5-cli php5-common php5-suhosin php5-cgi php-pear php5-mysql htop git
  4. Set root password sudo passwd root

###Setup PHP

  1. Change /etc/nginx/sites-available/default to:
server {
@lsirivong
lsirivong / text.php
Created December 19, 2012 18:30
Changes for Contact Form 7 Version 3.3.2 [1] to use the placeholder attribute for watermarks, instead of the original JS + title attr implementation. [1]: http://contactform7.com/
<?php
/**
** A base module for [text], [text*], [email], and [email*]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'text', 'wpcf7_text_shortcode_handler', true );
wpcf7_add_shortcode( 'text*', 'wpcf7_text_shortcode_handler', true );
wpcf7_add_shortcode( 'email', 'wpcf7_text_shortcode_handler', true );
@mauriciodarocha
mauriciodarocha / is_logged.js
Last active December 12, 2015 01:08
Função para verificar se usuário está "logado" em loja Vtex
/*
*
* Função para verificar se existe usuário logado em loja Vtex
*
* Uso:
* if(is_logged()) {
* // código se está logado
* } else {
* // código se NÃO está logado
* }
@JamieMason
JamieMason / is_installed.sh
Last active February 17, 2024 10:12
Check if a program exists from a bash script.Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
@wpscholar
wpscholar / functions.php
Last active October 20, 2024 14:01
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@jameskoster
jameskoster / functions.php
Last active July 29, 2022 10:01
WooCommerce - display category image on category archive
add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 );
function woocommerce_category_image() {
if ( is_product_category() ){
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
if ( $image ) {
echo '<img src="' . $image . '" alt="' . $cat->name . '" />';
}
@xeoncross
xeoncross / video_duration.php
Last active February 15, 2021 06:41
Get video duration from ffmpeg
<?php
$file = 'TrunkMonkey_Rescue.mov';
$result = shell_exec('ffmpeg -i ' . escapeshellcmd($file) . ' 2>&1');
preg_match('/(?<=Duration: )(\d{2}:\d{2}:\d{2})\.\d{2}/', $result, $match);
print_r($match);