Skip to content

Instantly share code, notes, and snippets.

View sergeylukin's full-sized avatar
🎯
Focusing

Sergey Lukin sergeylukin

🎯
Focusing
View GitHub Profile
@ryanflorence
ryanflorence / universal-module.js
Created September 6, 2011 18:10
Universal JavaScript Module, supports AMD (RequireJS), Node.js, and the browser.
(function (name, definition){
if (typeof define === 'function'){ // AMD
define(definition);
} else if (typeof module !== 'undefined' && module.exports) { // Node.js
module.exports = definition();
} else { // Browser
var theModule = definition(), global = this, old = global[name];
theModule.noConflict = function () {
global[name] = old;
return theModule;
@necolas
necolas / README.md
Last active March 28, 2024 20:34
Experimenting with component-based HTML/CSS naming and patterns

NOTE I now use the conventions detailed in the SUIT framework

Template Components

Used to provide structural templates.

Pattern

t-template-name
@caniszczyk
caniszczyk / git-pre-receive-hook.sh
Created October 31, 2011 13:17
A reasonable git pre-receive-hook
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@nervetattoo
nervetattoo / console.log.vim
Created September 6, 2012 08:13
console.log in vim
" Console log from insert mode; Puts focus inside parentheses
imap cll console.log();<Esc>==f(a
" Console log from visual mode on next line, puts visual selection inside parentheses
vmap cll yocll<Esc>p
" Console log from normal mode, inserted on next line with word your on inside parentheses
nmap cll yiwocll<Esc>p
@balupton
balupton / README.md
Last active December 10, 2015 06:58
DocPad: Bundle your scripts with Browserify

DocPad: Bundle your scripts with Browserify

The following will bundle your script assets with browserify each time a generation write completes. The bundled file will be located at my-website/out/scripts.js if you are using all the default configuration for your paths.

Installation

  1. Install Dependencies
@SimonSimCity
SimonSimCity / pagination.html.twig
Last active September 30, 2023 17:29
A gist for pagination in Twig, based on the total number of pages, the current page and some URL-settings.
{#
Source: http://dev.dbl-a.com/symfony-2-0/symfony2-and-twig-pagination/
Updated by: Simon Schick <simonsimcity@gmail.com>
Parameters:
* currentFilters (array) : associative array that contains the current route-arguments
* currentPage (int) : the current page you are in
* paginationPath (string) : the route name to use for links
* showAlwaysFirstAndLast (bool) : Always show first and last link (just disabled)
* lastPage (int) : represents the total number of existing pages
@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@ck-on
ck-on / ocp.php
Last active March 25, 2024 09:30
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@weotch
weotch / Laravel 4: Service Providers and Facades.md
Last active December 15, 2019 01:55
Laravel 4: Service Providers and Facades

Lets look at how Facades work in Laravel 4 by investigating the flow of one of the facaded classes: URL. As in <?=URL::route('news')?>.

The logic flow

As you'll see in the summary, this isn't exactly described in the procedural order your app is executed. But I think it serves to explain what's going on.

  1. The app config has an aliases array. In there is: 'URL' => 'Illuminate\Support\Facades\URL'. If you look up that class, you'll see it just has this: protected static function getFacadeAccessor() { return 'url'; } and that it inherits from Illuminate\Support\Facades\Facade. We'll get back to this later.

  2. Lets now turn to how the app boots up. The /vendor/laravel/framework/src/Illuminate/Foundation/start.php bootstrap file calls registerAliasLoader() on an instance of Illuminate\Foundation\Application.