Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
🍖

Norio Suzuki suzuki

🔥
🍖
View GitHub Profile
@suzuki
suzuki / mail2.php
Created Feb 2, 2014
Swift Mailer sample / DKIM email
View mail2.php
<?php
require 'vendor/autoload.php';
$transport = Swift_SmtpTransport::newInstance('localhost', 25);
$mailer = Swift_Mailer::newInstance($transport);
// DKIM 用の Signer を作成する
$privateKey = file_get_contents('./default.private');
$domainName = 'example.com';
@suzuki
suzuki / firefox-developer-edition.rb
Created Nov 11, 2014
Homebrew Cask: Cask file for Firefox Developer Edition
View firefox-developer-edition.rb
class FirefoxDeveloperEdition < Cask
version :latest
sha256 :no_check
url 'https://download.mozilla.org/?product=firefox-aurora-latest-ssl&os=osx&lang=en-US'
homepage 'https://www.mozilla.org/en-US/firefox/developer/'
license :mpl
app 'FirefoxDeveloperEdition.app'
end
View sample.sh
#!/bin/sh
DIRS=`find ./ -type d -name .git -depth 3`
for D in $DIRS
do
pushd . > /dev/null
cd $D
echo `dirname $D`
git rev-parse --abbrev-ref HEAD
popd > /dev/null
done
@suzuki
suzuki / init-magit.el
Created Aug 12, 2013
face color for magit
View init-magit.el
;; magit.el
(require 'magit)
(eval-after-load 'magit
'(progn
(set-face-bold-p 'magit-item-highlight nil)
(set-face-background 'magit-item-highlight nil)
(set-face-foreground 'magit-diff-add "#000000")
(set-face-background 'magit-diff-add "#ddffdd")
@suzuki
suzuki / gist:6127533
Created Aug 1, 2013
Reload page on Google Chrome from Emacs using AppleScript. Many thanks : http://d.hatena.ne.jp/anatoo/20120402/1333377979
View gist:6127533
(defun chrome-reload ()
(interactive)
(shell-command "/usr/bin/osascript /path/to/chrome_reload.scpt" nil))
(global-set-key (kbd "C-,") 'chrome-reload)
@suzuki
suzuki / toggle-scratch.el
Created Jan 17, 2013
Toggle current buffer and *scratch* buffer.
View toggle-scratch.el
(defvar toggle-scratch-prev-buffer nil)
(defun toggle-scratch()
"go to *scratch* buffer"
(interactive)
(if (not (string= "*scratch*" (buffer-name)))
(progn
(setq toggle-scratch-prev-buffer (buffer-name))
(switch-to-buffer "*scratch*"))
(switch-to-buffer toggle-scratch-prev-buffer)))
View gist:4425864
500 Internal Server Error
cannot load such file -- pygments (LoadError)
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/tdiary/tdiary/core/tdiary/style/gfm_style.rb:24:in `block_code'
/home/tdiary/tdiary/core/tdiary/style/gfm_style.rb:120:in `render'
/home/tdiary/tdiary/core/tdiary/style/gfm_style.rb:120:in `to_html'
/home/tdiary/tdiary/core/tdiary/style/gfm_style.rb:50:in `initialize'
View gist:c2ad457316e378eba3ca
% cat composer.json
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/yahoojapan/yconnect-php-sdk"
}
],
"require": {
"yahoojapan/yconnect-php-sdk": "dev-master"
@suzuki
suzuki / gist:2760759
Created May 21, 2012
An idea of CakeEmail content-type detection
View gist:2760759
protected function _getContentTypeCharset() {
switch($this->charset) {
case 'iso-2022-jp-ms':
$charset = 'iso-2022-jp';
break;
default:
$charset = $this->charset;
}
return $charset;
}
@suzuki
suzuki / gist:2715870
Created May 17, 2012
CandyCane with PostgreSQL
View gist:2715870
$ git diff app/Model/Project.php
diff --git a/app/Model/Project.php b/app/Model/Project.php
index af47298..fa9c98e 100755
--- a/app/Model/Project.php
+++ b/app/Model/Project.php
@@ -329,7 +329,7 @@ class Project extends AppModel {
$enabledModuleTable = $this->EnabledModule->tablePrefix . $this->EnabledModule->table;
$emName = $perm['project_module'];
- $base_statement[] = array("EXISTS (SELECT em.id FROM $enabledModuleTable em WHERE em.name='$emName' AND em.project_id=$projectTable.id)" => true);
You can’t perform that action at this time.