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
// <a rel="smoothscroll" href="#foo">got to foo</a> | |
// <div id="foo">Foo content</div> | |
$(function () { | |
$('a[rel=smoothscroll]').click(function( event ) { | |
var location = window.location, | |
hash = $(this).attr('href') | |
; | |
$('html, body') | |
.stop() | |
.animate({scrollTop: $(hash).offset().top}, 800, 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
from sqlalchemy.ext.declarative import declarative_base | |
class Mixin: | |
def as_dict(self): | |
return {c.name: getattr(self, c.name) for c in self.__table__.columns} | |
def as_clear_dict(self): | |
_dict = {} | |
for c in self.__table__.columns: | |
if c.foreign_keys: | |
continue |
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
# ------------------------------------------------------------------------------ | |
# | |
# Curtousy of the Magento Support Center | |
# http://magentosupport.help/what-are-expires-headers-and-how-do-i-implement-them/ | |
# | |
# ------------------------------------------------------------------------------ | |
# ------------------------------------------------------------------------------ | |
# | Mod Caching via Apache | |
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
if ( (isset($_SERVER["HTTP_X_PURPOSE"]) and (strtolower($_SERVER["HTTP_X_PURPOSE"]) == "preview")) or | |
(isset($_SERVER["HTTP_X_MOZ"]) and (strtolower($_SERVER["HTTP_X_MOZ"]) == "prefetch")) ) { | |
// Request is a prerender or prefetch | |
} else { | |
// Request is 'normal' | |
} |
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 | |
use GuzzleHttp\Client; | |
use GuzzleHttp\Exception\ConnectException; | |
use GuzzleHttp\Exception\RequestException; | |
use GuzzleHttp\Handler\CurlHandler; | |
use GuzzleHttp\HandlerStack; | |
use GuzzleHttp\Psr7\Request as Psr7Request; | |
use GuzzleHttp\Psr7\Response as Psr7Response; | |
use Psr\Log\LoggerInterface; | |
const MAX_RETRIES = 2; |
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
-- http://stackoverflow.com/questions/1124603/grouped-limit-in-postgresql-show-the-first-n-rows-for-each-group | |
-- http://www.postgresql.jp/document/9.2/html/tutorial-window.html | |
CREATE TABLE empsalary ( | |
depname varchar(10) not null | |
, empno integer not null | |
, salary integer not null | |
); | |
INSERT INTO empsalary (depname, empno, salary) VALUES ('develop', 11, 5200); |
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
# stop script on error signal | |
set -e | |
SITE="your-site-original-folder-name.com" | |
DEPL="/home/forge/deployments/${SITE}" | |
# create directory and any intermediate directories if don't exist | |
mkdir -p ${DEPL} | |
CUR="/home/forge/${SITE}" |
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
from celery import chain | |
from django.core.management.base import BaseCommand | |
from . import tasks | |
class Command(BaseCommand): | |
def handle(self, *args, **kwargs): |
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
/** | |
* Axios Request Wrapper | |
* --------------------- | |
* | |
* @author Sheharyar Naseer (@sheharyarn) | |
* @license MIT | |
* | |
*/ | |
import axios from 'axios' |
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 | |
# app/Http/Controllers/CaddyController.php | |
namespace App\Http\Controllers; | |
use App\Store; | |
use Illuminate\Http\Request; | |
class CaddyController extends Controller | |
{ |
OlderNewer