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/sh | |
# svnrepo/hooks/post-commit | |
cd /var/www/example.com | |
svn up |
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 | |
if ($handle = opendir('.')) { | |
echo '<ul>'; | |
while (false !== ($file = readdir($handle))) { | |
if ($file[0] == '.') { | |
continue; // skip dot-files | |
} | |
if (is_dir($file)) { | |
$file .= '/'; |
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 | |
if ($handle = opendir('.')) { | |
echo '<ul>'; | |
while (false !== ($file = readdir($handle))) { | |
if ($file[0] == '.') { | |
continue; // skip dot-files | |
} | |
if (is_dir($file)) { | |
$file .= '/'; |
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 | |
$bad_files = array('file1', 'file2', 'file3'); | |
if ($handle = opendir('.')) { | |
echo '<ul>'; | |
while (false !== ($file = readdir($handle))) { | |
if ($file[0] == '.') { | |
continue; // skip dot-files | |
} |
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 | |
namespace Symfony\Component\HttpFoundation; | |
class JsonResponse extends Response | |
{ | |
public function __construct($data) | |
{ | |
parent::__construct( | |
json_encode($data), |
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
#!/usr/bin/env php | |
<?php | |
// http://twitter.com/#!/Xopus/status/88187651705946112 | |
// "We ask new devs to write program to find equation with 3, 6, 9, 12, 15 | |
// (all) and +, -, *, / (any) which equals 381. Many struggle. Can you do it?" | |
// Let's rock! This one is for classic PHP4 style. Very dumb. |
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 | |
$data = array( | |
array( | |
'id' => 101, | |
'name' => 'Foo', | |
), | |
array( | |
'id' => 102, | |
'name' => 'Bar', |
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
#!/usr/bin/python | |
# this works as I expect, result is [[1, 2, 3], [4, 5, 6], [7, 8, 9]] | |
q = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] | |
# this works strange, result is [[7, 8, 9], [7, 8, 9], [7, 8, 9]] | |
q = [[0]*3]*3 | |
z = 0 | |
for y in range(3): |
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
// This code is OK | |
if (navigator.geolocation) { | |
deploySelfDrivingCar() | |
notifyFlyingMonkeys() | |
} else { | |
asknicelyforlocation() | |
} | |
// Not OK | |
foo(); bar(); |
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
% grep Audio ~/.fluxbox/keys | |
XF86AudioPlay :ExecCommand mpc toggle | |
XF86AudioPrev :ExecCommand mpc prev | |
XF86AudioNext :ExecCommand mpc next | |
XF86AudioStop :ExecCommand mpc stop | |
XF86AudioLowerVolume :ExecCommand aumix -v-10 | |
XF86AudioRaiseVolume :ExecCommand aumix -v+10 | |
XF86AudioMute :ExecCommand aumix -v 0 |
OlderNewer