Skip to content

Instantly share code, notes, and snippets.

ph3nx ph3nx

Block or report user

Report or block ph3nx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ph3nx
ph3nx / index.html
Created Jan 30, 2015
Zeit [add your bin description] // source http://jsbin.com/gazuge
View index.html
<!DOCTYPE html>
<html></html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Zeit<style id="jsbin-css">
body {
font: 16px helvetica, arial, sans-serif;
background-color: #eee;
margin: 10px;
}
@ph3nx
ph3nx / cardfan.css
Last active Aug 29, 2015
CardFan for TSS website.
View cardfan.css
body {
background-color: #fff;
font-size: 16px;
font-family: helvetica;
}
.jwlogo {
display: none;
}
@ph3nx
ph3nx / jwplayer.html
Created Feb 26, 2014
This is how you setup the jwplayer with a self-hosted video file. The official documentation: http://www.longtailvideo.com/support/jw-player/28833/quick-start-guide
View jwplayer.html
<!-- JW Player Library -->
<script src="http://jwpsrv.com/library/MCK8hplLEeOY0CIACmOLpg.js"></script>
<!-- div for the player -->
<div id='playerKXSDPIwKERSv'></div>
<!-- Script to display video file in the player div -->
<script type='text/javascript'>
jwplayer('playerKXSDPIwKERSv').setup({
// URL to the video file
@ph3nx
ph3nx / app_generator.sh
Created Feb 8, 2014
Shell script to generate an rails app with postgres database in osx mavericks.
View app_generator.sh
#!/bin/bash
case "$1" in
"n" )
if [ -z $2 ]
then
echo "Specify an app name"
else
if [ -d ~/rails/$2 ]
then
echo "App '$2' exists already"
@ph3nx
ph3nx / disable_osx_dashboard.sh
Last active Aug 29, 2015
Disable Dashboard in osx mavericks.
View disable_osx_dashboard.sh
# Disable Dashboard
defaults write com.apple.dashboard mcx-disabled -boolean true
killall Dashboard
# Enable Dashboard
defaults write com.apple.dashboard mcx-disabled -boolean false
killall Dashboard
@ph3nx
ph3nx / start_chrome.bat
Last active Aug 29, 2015
Batchfile to copy updated project files in the webroot and open the website in chrome.
View start_chrome.bat
xcopy /s /Y C:\Users\Pascal\drive\Projects\karteikarten C:\xampp\htdocs\karteikarten
chrome "http://localhost/karteikarten"
@ph3nx
ph3nx / round_down_proc.rb
Created Jan 21, 2014
Ruby example that explains the usage of Proc's.
View round_down_proc.rb
floats = [1.2, 3.45, 0.91, 7.727, 11.42, 482.911]
# Write your code below this line!
round_down = Proc.new { |f| f.floor }
# Write your code above this line!
ints = floats.collect(&round_down)
@ph3nx
ph3nx / case.rb
Created Jan 20, 2014
Some examples for the case method in Ruby.
View case.rb
case var
when 1
puts 1
when 2
puts 2
else
puts 'none'
end
case var
@ph3nx
ph3nx / benchmark_string_vs_symbol.rb
Created Jan 20, 2014
Simple Ruby benchmark to benchmark strings and symbols.
View benchmark_string_vs_symbol.rb
require 'benchmark'
string_AZ = Hash[("a".."z").to_a.zip((1..26).to_a)]
symbol_AZ = Hash[(:a..:z).to_a.zip((1..26).to_a)]
string_time = Benchmark.realtime do
100_000.times { string_AZ["r"] }
end
symbol_time = Benchmark.realtime do
@ph3nx
ph3nx / alphabetize.rb
Last active Jun 28, 2018
The Ruby method "alphabetize" sorts an array in alphabetical order. If you wish put true as second argument to sort in descending order.
View alphabetize.rb
def alphabetize arr, rev=false
if rev
arr.sort.reverse
else
arr.sort
end
end
puts alphabetize ["b","e","a"], true
# => ["e","b","a"]
You can’t perform that action at this time.