This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--註解--> | |
<!-- <link rel="stylesheet" type="text/css" href="http://www.fashionguide.com.tw/jquery.autocomplete.css" /> --> | |
<!-- <script src="http://www.fashionguide.com.tw/js/jquery-1.6.2.min.js" type="text/javascript"></script> --> | |
<!-- <script src="http://www.fashionguide.com.tw/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script> --> | |
<!-- <script src="http://www.fashionguide.com.tw/js/jquery.autocomplete.min.js" type="text/javascript"></script> --> | |
<!--加入新的 jquery --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> | |
<script src="http://code.jquery.com/ui/1.8.18/jquery-ui.min.js" type="text/javascript"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function encrypt($str, $key) | |
{ | |
$block = mcrypt_get_block_size('des', 'ecb'); | |
$pad = $block - (strlen($str) % $block); | |
$str .= str_repeat(chr($pad), $pad); | |
return base64_encode(mcrypt_encrypt(MCRYPT_DES, $key, $str, MCRYPT_MODE_ECB)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$key = "admlX71MbBLlEznv"; | |
$text = "fleshwound is a farmer,deadly wounded ";//明文 | |
$ctext = base64_encode (mcrypt_ecb (MCRYPT_3DES, $key, $text, MCRYPT_ENCRYPT) ); //加密 | |
$ptext = mcrypt_ecb (MCRYPT_3DES, $key,base64_decode($ctext), MCRYPT_DECRYPT); //解密 | |
echo "明文:$text <br> 密文:$ctext <br>解密后明文:$ptext" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Controller | |
include LazyLoad | |
def show | |
@model = Model.find(...) | |
respond_to do |format| | |
format.html do | |
@html_specific_data = Model.find(...) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe class="youtube-player" id="player" type="text/html" src="http://www.youtube.com/embed/EnErifh93hM?autoplay=1" height="600px" width="400px"></iframe> | |
<!-- 1. The <div> tag will contain the <iframe> (and video player) --> | |
<div id="player"></div> | |
<script> // 2. This code loads the IFrame Player API code asynchronously. | |
var tag = document.createElement('script'); | |
tag.src = "http://www.youtube.com/player_api"; | |
var firstScriptTag = document.getElementsByTagName('script')[0]; | |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe class="youtube-player" id="player" type="text/html" src="http://www.youtube.com/embed/EnErifh93hM?autoplay=1" height="400px" width="600px"></iframe> | |
<!-- 1. The <div> tag will contain the <iframe> (and video player) --> | |
<div id="player"></div> | |
<script> // 2. This code loads the IFrame Player API code asynchronously. | |
var tag = document.createElement('script'); | |
tag.src = "http://www.youtube.com/player_api"; | |
var firstScriptTag = document.getElementsByTagName('script')[0]; | |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe class="youtube-player" id="player" type="text/html" src="http://www.youtube.com/embed/EnErifh93hM?autoplay=1" height="400px" width="600px"></iframe> | |
<!-- 1. The <div> tag will contain the <iframe> (and video player) --> | |
<div id="player"></div> | |
<script> // 2. This code loads the IFrame Player API code asynchronously. | |
var tag = document.createElement('script'); | |
tag.src = "http://www.youtube.com/player_api"; | |
var firstScriptTag = document.getElementsByTagName('script')[0]; | |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Optimized for writes, sort on read | |
# LVC | |
redis.hset("bonds|1", "bid_price", 96.01) | |
redis.hset("bonds|1", "ask_price", 97.53) | |
redis.hset("bonds|2", "bid_price", 95.50) | |
redis.hset("bonds|2", "ask_price", 98.25) | |
redis.sadd("bond_ids", 1) | |
redis.sadd("bond_ids", 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in controller | |
# for local files | |
send_file '/path/to/file', :type => 'image/jpeg', :disposition => 'attachment' | |
# for remote files | |
require 'open-uri' | |
url = 'http://someserver.com/path/../filename.jpg' | |
data = open(url).read | |
send_data data, :disposition => 'attachment', :filename=>"photo.jpg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="http://run26kimo.github.io/we-are-g0v/FileSaver.js"></script> | |
<script type="text/javascript" src="http://run26kimo.github.io/we-are-g0v/filer.min.js"></script> | |
<script type="text/javascript"> | |
function download(){ | |
blob = Util.dataURLToBlob(getBase64()); | |
saveAs(blob,'cover.png') | |
} | |
</script> |
OlderNewer