Skip to content

Instantly share code, notes, and snippets.

View intellecat's full-sized avatar
🌴
On vacation

geecat intellecat

🌴
On vacation
  • CatЯun
  • NZ
  • 16:23 (UTC +13:00)
View GitHub Profile
@jankuca
jankuca / wysihat.js
Created January 17, 2011 14:05
Modified WysiHat v0.2.1; not forked the original repository because rake is required
/* WysiHat - WYSIWYG JavaScript framework, version 0.2.1
* (c) 2008-2010 Joshua Peek
*
* WysiHat is freely distributable under the terms of an MIT-style license.
*--------------------------------------------------------------------------*/
(function (window) {
var WysiHat = {};
@stas
stas / jquery.cleditor.pastecode.js
Created February 21, 2011 16:16
CLEditor pastecode (pre/code) plugin
// Just append `pastecode` to your controls
(function($) {
$.cleditor.buttons.pastecode = {
name: "pastecode",
image: "",
title: "Code",
command: "inserthtml",
popupName: "pastecode",
popupClass: "cleditorPrompt",
popupContent: "Paste the code:<br /><textarea cols='40' rows='3'></textarea><br /><input type='button' value='Ok' />",
@xjamundx
xjamundx / express-pagination.js
Created April 19, 2011 05:28
sample pagination using express route-specific middleware
// articles per page
var limit = 10;
// pagination middleware function sets some
// local view variables that any view can use
function pagination(req, res, next) {
var page = parseInt(req.params.page) || 1,
num = page * limit;
db.articles.count(function(err, total) {
res.local("total", total);
@osiloke
osiloke / gist:1138798
Created August 11, 2011 02:38 — forked from saidimu/gist:1024207
Generating URLs to crawl from outside a Scrapy spider
from scrapy import log
from scrapy.item import Item
from scrapy.http import Request
from scrapy.contrib.spiders import XMLFeedSpider
def NextURL():
"""
Generate a list of URLs to crawl. You can query a database or come up with some other means
Note that if you generate URLs to crawl from a scraped URL then you're better of using a
@gpluess
gpluess / README.md
Created February 22, 2012 12:52
IE6 patch for the Twitter Bootstrap grid system

These patches provide basic support for the Bootstrap grid system in Internet Explorer 6. The JavaScript code requires jQuery.

Feel free to fork & improve.

@dndx
dndx / xiami_decode.py
Created April 29, 2012 14:42
Xiami URL Decoder
import urllib2
def xiami_decode(s):
s = s.strip()
if not s:
return False
result = []
line = int(s[0])
rows = len(s[1:]) / line
extra = len(s[1:]) % line
@zythum
zythum / gist:2848881
Created June 1, 2012 04:50
google收录的敏感词
({:username "imakewebthings",
:name "Caleb Troughton",
:language "JavaScript",
:score 5476.8}
{:username "flyerhzm",
:name "Richard Huang",
:language "Ruby",
:score 2776.2}
{:username "fredwu",
:name "Fred Wu",
@mkuklis
mkuklis / gist:4712839
Last active December 12, 2015 04:18
requirejs+flight
// requirejs config in main.js
require.config({
paths: {
jquery: 'components/jquery/jquery',
es5shim: 'components/es5-shim/es5-shim',
es5sham: 'components/es5-shim/es5-sham'
},
map: {
'*': {
'flight/component': 'components/flight/lib/component',
@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.