Skip to content

Instantly share code, notes, and snippets.

View mpyw's full-sized avatar
🏠
Working from home

mpyw mpyw

🏠
Working from home
View GitHub Profile
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@haf
haf / gist:2843680
Created May 31, 2012 14:19
Get SSH working on Vagrant/Windows/Git

If you are using vagrant, you probably-statistically are using git. Make sure you have its binary folder on your path, because that path contains 'ssh.exe'.

Now, modify C:\vagrant\vagrant\embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\ssh.rb to comment out the faulty Windows check and add a real SSH check:

# if Util::Platform.windows?
  # raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
                                       # :port => ssh_info[:port],
                                       # :username => ssh_info[:username],
 # :key_path => ssh_info[:private_key_path]
@shobotch
shobotch / gist:2882296
Created June 6, 2012 14:40
スマホと振り分け
-------------sortingUa.php-------------
<?php
/**
* スマートフォンかどうかを振り分ける簡易的なクラスです。
*
* @package sortingUa
* @author shobotch
* @sinse PHP 5.3.8
* @version 1.0.0
*/
@johanmeiring
johanmeiring / gist:2894568
Created June 8, 2012 08:52
PHP str_putcsv function
<?php
/* From: http://www.php.net/manual/en/function.str-getcsv.php#88773 and http://www.php.net/manual/en/function.str-getcsv.php#91170 */
if(!function_exists('str_putcsv'))
{
function str_putcsv($input, $delimiter = ',', $enclosure = '"')
{
// Open a memory "file" for read/write...
$fp = fopen('php://temp', 'r+');
// ... write the $input array to the "file" using fputcsv()...
fputcsv($fp, $input, $delimiter, $enclosure);
fizz = function f() {
fizz = function () {
fizz = function () {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {
@cboden
cboden / certificate.pem
Created August 19, 2012 16:03
No Async SSL w/ PHP
-----BEGIN CERTIFICATE-----
MIIEFzCCAv+gAwIBAgIBADANBgkqhkiG9w0BAQQFADBqMQswCQYDVQQGEwJkZTEP
MA0GA1UECBMGSGVzc2VuMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBM
dGQxEzARBgNVBAcTCkRpbGxlbmJ1cmcxEjAQBgNVBAMTCTEyNy4wLjAuMTAeFw0x
MjA2MTYyMDE2MDhaFw0yMjA2MTQyMDE2MDhaMGoxCzAJBgNVBAYTAmRlMQ8wDQYD
VQQIEwZIZXNzZW4xITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDET
MBEGA1UEBxMKRGlsbGVuYnVyZzESMBAGA1UEAxMJMTI3LjAuMC4xMIIBIjANBgkq
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAofA7J9eN5Q8pTrbHOBQC63gB4m6NPNjx
NZ302U5VK5SIkT8lYNk/uwY88C93jAgEBjgSk9IcLdzCRIay5UJmf92fSwZS+x+7
V8nQyuMtQ+9uipX5nhFVAj1iGbO92McsuBb9ck1jQuNt5YZW1WsnGivh88vMiKBa
@uhfx
uhfx / gist:3922268
Last active July 22, 2023 15:01
Twitter公式/非公式クライアントのコンシューマキー

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPad

Consumer key: CjulERsDeqhhjSme66ECg

@Cside
Cside / repl.rc
Created November 13, 2012 14:16
~/.re.pl/repl.rc
#!perl
=pod
Original rc file is https://gist.github.com/3fb14d60757e29f8ef13.
ttakezawa++
=cut
use strict;
use warnings;
use Term::ANSIColor;
@kanonji
kanonji / 20121115-CakePHP2-Model_find_joins.md
Created November 19, 2012 11:07
CakePHP2でModel->find()でjoinsを使ってみた
$option = array();
$option['recursive'] = -1; 
$option['joins'][] = array(
    'type' => 'LEFT',   //LEFT, INNER, OUTER
    'table' => 'posts',
    'alias' => 'Post',    //下でPost.user_idと書くために
    'conditions' => '`User`.`id`=`Post`.`user_id`',
);
$option['conditions'] = array('Post.isPrivate' => 1);
@seiyaKai
seiyaKai / TwitterAccountSearch.php
Last active December 10, 2015 06:08
くっそ重いです。下手くそですが…Twitterのスクリーンネームの空きを検索してくれます。 $screen_names に検索したいスクリーンネームを入れていってください。 3文字IDとかいろいろ調べられるんじゃね〜みたいな?
<?php
$screen_names = array(); // 検索したいスクリーンネームをarrayのかたちで入れてください
for ($i=0 ; $i<10; $i++){
$screen_names[] = "hogepiyo".$i;
}
$tas = new TwitterAccountSearch();
$tas->Set($screen_names);
$tas->Search();