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
var F = (function() { | |
function typeOf(obj) { | |
return {}.toString.call(obj).slice(8,-1).toLowerCase(); | |
} | |
function F(fns) { | |
return function() { |
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 | |
function wrap($text, $keywords, $tag = 'span') | |
{ | |
$keywords = array_map(function($k){ return preg_quote($k); }, $keywords); | |
return preg_replace('/'. implode('|', $keywords) .'/i', "<$tag>$0</$tag>", $text); | |
} | |
$text = 'Scelerisque lectus aliquet egestas et placerat dis aliquet odio auctor in adipiscing in platea. Etiam rhoncus tortor tortor ut? Vel vel non elementum habitasse adipiscing, dis odio lundium sed mauris, urna phasellus a magna rhoncus non turpis, a, in urna non? Eu pellentesque lorem, porta scelerisque rhoncus sed massa in cum velit! Pulvinar. Magna ac dignissim, augue turpis magnis ut, arcu, duis? Ac porttitor rhoncus. Sagittis ut, pulvinar eros, tincidunt, facilisis pellentesque ridiculus, elementum tristique elit urna? Sed pulvinar vel quis? Dapibus cum nascetur, sed, cras pulvinar elementum? Augue.'; |
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 /srv/git | |
adduser myuser www-data | |
git init --bare --shared=group /srv/git/app.git | |
mkdir /var/www/app | |
chown -R www-data:www-data /srv/git/app.git /var/www/app | |
chmod -R g+rw /srv/git/app.git /var/www/app | |
vim /srv/git/app.git/hooks/post-receive | |
#!/bin/sh | |
export GIT_WORK_TREE=/var/www/app |
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 | |
/** | |
* Plugin Name: Email Confirmation | |
* Description: Send an email to the user with confirmation code and store form data in database until user confirms. | |
* Author: Cedric Ruiz | |
*/ | |
class EmailConfirmation | |
{ | |
const PREFIX = 'email-confirmation-'; |
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 | |
// some php | |
?> | |
<html> | |
<head> | |
<script> | |
function logout() { | |
var r = confirm('Are you sure you want to logout?'); | |
if (r) window.location.href = 'http://www.google.com'; |
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
// Generated by LiveScript 1.2.0 | |
var query, vars; | |
query = { | |
parse: function(query){ | |
var vars, patt; | |
vars = {}; | |
patt = /[?&]([^&]+)=([^&]+)/g; | |
query = decodeURIComponent(query); | |
query.replace(patt, function(_, key, val){ | |
return vars[key] = isNaN(val) |
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
# adduser myuser www-data | |
mkdir /var/www/site | |
git init --bare --shared=group /srv/git/repo.git | |
chgrp -R www-data /srv/git/repo.git /var/www/site | |
chmod g+rw /var/www/site | |
vim /srv/git/repo.git/hooks/post-receive | |
#!/bin/sh | |
export GIT_WORK_TREE=/var/www/site | |
git checkout -f | |
chmod +x /srv/git/repo.git/hooks/post-receive |
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
var Example, example; | |
Example = (function() { | |
var someFunction; | |
Example.text = 'Hello world! ;)'; | |
someFunction = function() { | |
return alert(this.getText()); | |
}; |
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 | |
$str = 'Hello world'; | |
$word = 'world'; | |
$res1 = preg_replace('/'.$word.'/i', '- $1 -', $str); | |
$res2 = preg_replace('/'.$word.'/i', '- $0 -', $str); | |
echo $res1; | |
echo '<br>'; |
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
$('#test').on('submit', function(){ | |
var $required = $('input.required'); | |
var $url = $('input[name=url]'); | |
$required.add($url).removeClass('error'); | |
var $invalid = $required.add($url).filter(function(){ | |
return !this.value || !isValidUrl(this.value); | |
}); |