Skip to content

Instantly share code, notes, and snippets.

<?php
session_start();
require_once 'vendor/autoload.php';
$consumerKey = 'doTy109KhSbt4QKzdYWDns7lIWMhiehHKJ29NNsc6VS0CImPUU';
$consumerSecret = 'AsPvCGXe13Ydvcovu8uCyX4WhNk7chLoGM7bNMpH7hjQgA8FhI';
$tmpToken = isset($_SESSION['tmp_oauth_token'])? $_SESSION['tmp_oauth_token'] : null;
$tmpTokenSecret = isset($_SESSION['tmp_oauth_token_secret'])? $_SESSION['tmp_oauth_token_secret'] : null;
@lightsuner
lightsuner / gda
Last active August 29, 2015 13:56
How to use: gda HEAD~12 HEAD~4 file.zip - (All arguments are optional). Git Diff Archive Tool - small tool for archiving all changed files between two commits.
#!/bin/sh
NOW=$(date +"%Y-%m-%d_%H%M%S")
ZIP_FILENAME="git_diff_$NOW.zip"
FROM_SHA="HEAD~"
TO_SHA="HEAD"
FOREGROUND_COLOR="\033[0m"
GREEN_COLOR="\033[0;32m"
RED_COLOR="\033[0;31m"
@lightsuner
lightsuner / sf
Created March 4, 2014 08:19
Short Symfony2 console runner: sf doctrine:schema:update
#!/bin/sh
php app/console $@
@lightsuner
lightsuner / PrivateAccess.php
Last active August 29, 2015 13:57
Required php 5.4 - Provide access layer to private properties via anonymous functions
<?php
class TestClass
{
private $someVar;
public function __construct()
{
$this->someVar = 10;
function doubleInteger(i) {
// i will be an integer. Double it and return it.
return i * 2;
}
function isNumberEven(i) {
// i will be an integer. Return true if it's even, and false if it isn't.
function fibonacci(n)
{
if (n < 0) {
return;
}else if (n < 2) {
return '10'[n];
}
return fibonacci(n-1)+''+fibonacci(n-2)
}
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
<style type="text/css">
table {
font-size: 1px;
line-height: 1px;
}
</style>
<!--WARNING!!!! Only local image-->
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
Result: <div id="result"></div>
<script>
function hasAllPatterns(string) {
var requiredDigits = [
0,
1,2,3,4,5,6,7,8,9,
<?php
namespace CoreBundle\Service\Expert;
use Codeception\Util\Stub;
use Domain\CoreBundle\Service\Expert\ExpertManager;
use Codeception\Configuration as Configuration;
use Codeception\Exception\Module as ModuleException;
use Domain\CoreBundle\Entity\User;
$('body').on('activate.bs.scrollspy', function(e) {
var hash = $(e.target).find('a').attr('href');
if(history.pushState) {
history.pushState({}, "", hash);
} else {
// Uncomment this for ie8 or ie9
//window.location.hash = hash;
}