Skip to content

Instantly share code, notes, and snippets.

View ylluminate's full-sized avatar

ylluminate ylluminate

View GitHub Profile
@sproutventure
sproutventure / gist:44466
Created January 7, 2009 21:57
Redmine/Rails email through Gmail SMTP
require "openssl"
require "net/smtp"
Net::SMTP.class_eval do
private
def do_start(helodomain, user, secret, authtype)
raise IOError, 'SMTP session already started' if @started
check_auth_args user, secret if user or secret
sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
@remy
remy / trim-canvas.js
Last active May 3, 2024 13:39
Trims the surrounding transparent pixels from a canvas
// MIT http://rem.mit-license.org
function trim(c) {
var ctx = c.getContext('2d'),
copy = document.createElement('canvas').getContext('2d'),
pixels = ctx.getImageData(0, 0, c.width, c.height),
l = pixels.data.length,
i,
bound = {
top: null,
@jugyo
jugyo / gist:865475
Created March 11, 2011 05:02
TextMate command to convert slim to html
#!/usr/bin/env ruby
# Input: Selected Text or Nothing
# Output: Replace Selected Text
require 'tempfile'
def unindent(text)
lines = text.split(/\n/)
level = lines.map{|l| l[/^\s*/].size}.min
@ippy04
ippy04 / MailchimpDeliveryMethod
Created March 17, 2011 01:20
Delivery Method for Mailchimp STS and Amazon SES using Uakari
class MailchimpDeliveryMethod
attr_accessor :settings
def initialize(values = {})
self.settings = {:track_opens => true,
:track_clicks => true
}.merge!(values)
end
def deliver!(mail)
@kevinpfromnm
kevinpfromnm / controller.rb
Created June 29, 2011 04:12
example from tagglable hobo plugin (hobo 1.0.x)
autocomplete :new_tag_name do
post = find_instance
items = Tag.find(:all,:conditions => ['name LIKE ?',"%#{params[:query]}%"]).select { |i| i.viewable_by?(current_user) }
items = items - post.tags
render :text => "<ul>\n" +
items.map { |i| "<li>#{i.name}</li>\n" }.join +
"</ul>"
end
@inossidabile
inossidabile / Bundle.sh
Last active October 5, 2015 05:48
Joosy / Blog / Rails preparations
bundle install
@leolimajr
leolimajr / os-x-enable-trim.txt
Created November 21, 2012 11:10 — forked from clarencesong/os-x-enable-trim.md
Enable TRIM in OS X 10.8.2 for IOAHCIBlockStorage version 2.3.1
Enable TRIM on non-Apple SSDs in OS X 10.8.2 Mountain Lion.
WARNING: This is ONLY tested on 10.8.2 (IOAHCIBlockStorage version 2.3.1), and NOT earlier or later versions.
Check /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/version.plist
Technical note: The driver changed in 10.8.2 and similar perl commands that worked in earlier OS X versions did not work for me once I updated to 10.8.2.
Run the following commands in Terminal…

Disclaimer: This post is Meteor & Backbone beef. Both Meteor and Backbone are absolute genius, and far beyond anything I could dream to create. But IMO there are better tools. Prepare yourselves *gulp*, I need to get this off my chest.

First, Backbone. Why people? It revolutionized JavaScript, did wonderful things for the world, and served its purpose well. But now we have better tools, so let’s move on. It’s like Gentoo users proselytizing Gentoo to the masses, perpetuating it as most common Distro; where all this time, Ubuntu would have saved everyone countless hours. Not

@djs070
djs070 / gist:4570480
Last active November 14, 2017 06:26
Install NVM & Node 0.8.17 on Fedora/CentOS
# install git
yum install git -y
# get nvm
git clone git://github.com/creationix/nvm.git ~/nvm
# activate nvm
@ck-on
ck-on / ocp.php
Last active March 25, 2024 09:30
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter