Skip to content

Instantly share code, notes, and snippets.

View danielbehrendt's full-sized avatar

Daniel Behrendt danielbehrendt

View GitHub Profile
@cbess
cbess / gist:1393058
Created November 25, 2011 08:36
Set NSView layer background image
// Sets the view's background to the given image
// prior to call, you may need to execute: `view.wantsLayer = YES`
void SetBackgroundImage(NSView *view, NSString *imageName)
{
view.layer.contents = (id)[NSImage imageNamed:imageName];
}
@franck
franck / monitrc
Created December 1, 2011 11:11
monit config file (nginx, mysql, redis, tomcat)
###############################################################################
## Monit control file
###############################################################################
##
## Comments begin with a '#' and extend through the end of the line. Keywords
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
##
## Below you will find examples of some frequently used statements. For
## information about the control file, a complete list of statements and
## options please have a look in the monit manual.
@nathanl
nathanl / git_tag_cleanup.rb
Created January 20, 2012 16:10
Clean up tags in a git repository
# Script to delete all but a specified list of tags
# from a git repo, both locally and remotely
# Run like `mode=test ruby git_tag_cleanup` to test;
# use 'execute' mode to actually delete the tags
mode = ENV['mode'] || 'test'
tags_to_keep = %w[v2.0.0 v2.0.1]
tags_to_delete = `git tag`.split("\n") - tags_to_keep
@jamband
jamband / _form.twig
Last active November 15, 2017 19:07
Yii Framework & Twig: layouts/column1.twig
<div class="form">
{% set form = this.beginWidget('CActiveForm', {
'id': 'hoge-form',
'enableAjaxValidation': false,
}) %}
<p class="note">Fields with <span class="required">*</span> are required.</p>
{{ form.errorSummary(model) }}
@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@chrisle
chrisle / gist:2252209
Created March 30, 2012 15:15
CURL as GoogleBot 2.1
curl --user-agent "Googlebot/2.1 (+http://www.google.com/bot.html)" -v $@
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@jeremypeter
jeremypeter / Keyboard Shorcuts for Premailer Build System
Last active December 11, 2015 03:58
Sublime Text build system for Premailer. Creates a separate html or txt version with option to minify them once they have been converted.
[
{ "keys": ["ctrl+alt+super+c"], "command": "build", "args": {"variant": "Premailer - Inline Campaign Monitor"} },
{ "keys": ["ctrl+alt+super+m"], "command": "build", "args": {"variant": "Premailer - Minify HTML"} },
{ "keys": ["ctrl+alt+super+t"], "command": "build", "args": {"variant": "Premailer - Create Text Version"} }
]
@luckyshot
luckyshot / response.php
Last active December 30, 2019 16:02
Web scraping done right (with cUrl and user agent)
<?php return array (
'url' => 'https://xaviesteve.com/',
'content' => '<!doctype html><html>...</html>',
'cookies' => '__cfduid=d3fa669e1069e72c2e47d127ab9b8e11f1465390629',
'http_code' => 200,
'content_type' => 'text/html; charset=UTF-8',
'header_size' => 578,
'request_size' => 229,
'filetime' => -1,
'ssl_verify_result' => 0,
@yourdesigncoza
yourdesigncoza / monit-deamon-server-monitor
Created April 19, 2013 15:59
Monit is a utility for managing and monitoring, processes, programs, files, directories and file systems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations ::: " a great little utility that monitors your daemons " In Short it lets you know when your Apache server goes d…
# Monit is a utility for managing and monitoring, processes, programs, files, directories and file systems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations ::: " a great little utility that monitors your daemons "
# in Short it lets you know when your Apache server goes down, when you reach your pre-determined memory usage. It will also restart key components should they stop working, for instance your web server ( apache ) might "crash" due to a DDOS attack or similar, monit will attempt to restart said services notifying you of whats going on, depending on your mmonit configuration :::
# Official site : http://mmonit.com/
# IMPORTANT : add your own data or parameters, I make use of double segments [[ your variable ]]. eg. ssh root@[[ 96.172.44.11 ]] should be replaced with ssh root@888.88.88.88 where "888.88.88.88" is your value, variable etc. I have a habit of using ":::" to indicate line ending and end of paragraph, crazy I