https://speakerdeck.com/polarblau/a-primer-on-content-security-policy
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 Matrix | |
members: [[]] | |
@fromArray = (array, width)-> | |
chunks = [] | |
for _, index in array by width | |
chunks.push array.slice(index, index + width) | |
new Matrix(chunks) |
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
mkdir bash-fix | |
cd bash-fix | |
curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf - | |
cd bash-92/bash-3.2 | |
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0 | |
cd .. | |
xcodebuild | |
sudo cp /bin/bash /bin/bash.old | |
sudo cp /bin/sh /bin/sh.old | |
build/Release/bash --version # GNU bash, version 3.2.52(1)-release |
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 Track(src, spriteLength, audioLead) { | |
var track = this, | |
audio = document.createElement('audio'); | |
audio.src = src; | |
audio.autobuffer = true; | |
audio.load(); | |
audio.muted = true; // makes no difference on iOS :( | |
/* This is the magic. Since we can't preload, and loading requires a user's | |
input. So we bind a touch event to the body, and fingers crossed, the |
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
javascript:(function(){try{var video=find('.moviePanel object embed');var origWidth=video.width,origHeight=video.height,origStyleWidth=video.style.width,origStyleHeight=video.style.height;onEnterFullscreen(function(){video.width='100%';video.height='100%';video.style.width='100%';video.style.height='100%';});onExitFullscreen(function(){video.width=origWidth;video.height=origHeight;video.style.width=origStyleWidth;video.style.height=origStyleHeight;});fullscreen(video);}catch(e){}function getVideoSize(video){return[video.width,video.height,video.style.width,video.style.height];}function setVideoSize(video,size){video.width=size[0];video.height=size[1];video.style.width=size[2];video.style.height=size[3];}function find(query){return document.querySelector(query);}function isFullscreen(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;}function onFullscreenChange(cb){document.addEventListener('fullscreenchange',cb,false);document.ad |
Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Days: | 21 | 20 | 22 | 20 | 18 | 22 | 23 | 21 | 22 | 22 | 21 | 22 |
Hours: | 157,5 | 150 | 165 | 150 | 135 | 165 | 172,5 | 157,5 | 165 | 165 | 157,5 | 165 |
(Hours calculations are based on 7.5 hour days.)
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
gem install pg -- --with-pg_config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config |
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
#!/bin/bash | |
HOST="some-host.com" | |
ERROR_MESSAGE="Some Host server unreachable!" | |
while true | |
do | |
status=$(curl -s -I $HOST | grep HTTP/1.1 | awk {'print $2'}) | |
timestamp=$(date +"%Y-%m-%d %H:%M:%S") |
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 BaseCollection extends Backbone.Collection | |
_expiresAfter: 15 # seconds | |
_lastFetched: null | |
isStale: -> | |
now = (new Date()).getTime() | |
!@_lastFetched? || now - @_lastFetched > (@_expiresAfter * 1000) | |
refresh: (models, options) -> |
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
# install @sishen's ruby gem for access to Google's translate API access: | |
# https://github.com/sishen/rtranslate | |
$ gem install sishen-rtranslate | |
# add alias for quick access and reload: | |
# (adjust/add languages as needed) | |
$ echo "alias fin='rtranslate -f en -t fi'" >> .profile | |
$ source .profile | |
# try it: |