Skip to content

Instantly share code, notes, and snippets.

@olivierlacan
olivierlacan / sublime-text-2-settings.json
Last active January 11, 2024 15:38
Basic Sublime Text 2 settings for Rails development
{
"use_simple_full_screen": false,
// calculates indentation automatically when pressing enter
"auto_indent": true,
// sets the colors used within the text area (default)
// see https://github.com/olivierlacan/monokaim to download
// the customized Monokai I use.
"color_scheme": "Packages/Color Scheme - Default/Monokaim.tmTheme",
@defnull
defnull / tcping.py
Created December 4, 2011 21:11
TCPing
def ping(server, port):
''' Check if a server accepts connections on a specific TCP port '''
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((server, port))
s.close()
return True
except socket.error:
return False
@saetia
saetia / gist:1623487
Last active July 16, 2024 05:56
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@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 . '" />';
}
@josephj
josephj / happy-desinger-mini-1.md
Last active December 18, 2015 10:39
於 HappyDesigner Mini #1 分享會

JavaScript 品質工具:CodePaint 與 Plato

介紹協助提昇 F2E Code Style 的兩個工具。

分享者

josephj@faria

問題

@hwdsl2
hwdsl2 / .MOVED.md
Last active May 19, 2024 06:28
IPsec VPN Server Auto Setup Script for Ubuntu and Debian
@jsleetw
jsleetw / gist:9806390
Last active October 3, 2023 08:27
Optimizer image in command line
sudo apt-get install jpegoptim optipng
find . -type f -name "*.jpg" -exec jpegoptim {} \;
find . -type f -name "*.png" -exec optipng {} \;
find . -type f -name "*.jpeg" -exec jpegoptim {} \;
---
sudo apt-get install imagemagick
find . -type f -size +1000k -name "*.jpg" -exec convert {} -resize "2048>x2048>" {} \;
find . -type f -size +1000k -name "*.jpeg" -exec convert {} -resize "2048>x2048>" {} \;
find . -type f -size +1000k -name "*.png" -exec convert {} -resize "2048>x2048>" {} \;
@jbradach
jbradach / Init Script for Redmine using Puma
Last active August 29, 2015 14:05
Init script for Redmine and Puma
#! /bin/sh
### BEGIN INIT INFO
# Provides: redmine
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts redmine with puma
# Description: Starts redmine from /home/redmine/redmine.
### END INIT INFO
@frzsombor
frzsombor / gist:ddd0e11f93885060ef35
Last active July 4, 2024 12:56
Share Laravel's session and check authentication from external projects
<?php
/*
|--------------------------------------------------------------------------
| Sharing Laravel's session and checking authentication
|--------------------------------------------------------------------------
|
| Use the following code in any CMS (WordPress, Joomla, etc), filemanager (CKFinder,
| KCFinder, simogeos's Filemanager, etc), or any other non-Laravel project to boot into
| the Laravel framework, with session support, and check if the user is authenticated.
@shengyou
shengyou / initialize.sh
Last active August 24, 2016 07:46
COSCUP 2016 Laravel 部署工作坊裝機指令集
# get startup.sh from gist
wget https://gist.githubusercontent.com/shengyou/644b1ac28fa05e34146369e4bda53176/raw/06028bf9e9870aaed0085261bdbdbcc91a6b0128/startup.sh
# run startup script
bash startup.sh
# generate ssh key
ssh-keygen -t rsa -b 4096 -C "{your email}"
# clone your app