Skip to content

Instantly share code, notes, and snippets.

@joeylin
joeylin / gl-form.py
Created December 10, 2019 06:24 — forked from gpocentek/gl-form.py
python-gitlab login/password auth using cookies
import re
import sys
import requests
import gitlab
URL = 'https://gitlab.com'
SIGN_IN_URL = 'https://gitlab.com/users/sign_in'
@joeylin
joeylin / AutowiringSpringBeanJobFactory.java
Created June 6, 2017 02:25 — forked from jeffsheets/AutowiringSpringBeanJobFactory.java
Configuring Quartz 2.1.7 with Spring 3.1.3 in clustered mode
/**
* Autowire Quartz Jobs with Spring context dependencies
* @see http://stackoverflow.com/questions/6990767/inject-bean-reference-into-a-quartz-job-in-spring/15211030#15211030
*/
public final class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware {
private transient AutowireCapableBeanFactory beanFactory;
public void setApplicationContext(final ApplicationContext context) {
beanFactory = context.getAutowireCapableBeanFactory();
}
@joeylin
joeylin / angularjs-providers-explained.md
Last active August 29, 2015 14:25 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@joeylin
joeylin / api.js
Created April 14, 2014 13:51 — forked from fwielstra/api.js
node, mongoose, express example
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@joeylin
joeylin / scraping-with-casperjs.js
Created February 21, 2014 02:39 — forked from imjared/scraping-with-casperjs.js
A CasperJS script that crawled a list of links on then scraped the relevant content on each page and output it to a nicely formatted XML file. Sure beats database dumps/SQL manipulation, in my opinion.
/*jshint strict:false*/
/*global CasperError console phantom require*/
/**
* grab links and push them into xml
*/
var casper = require("casper").create({
});
@joeylin
joeylin / ghostPlugin.js
Last active November 10, 2018 23:41 — forked from jgable/index.js
a ghost plugin example
var fs = require('fs'),
path = require('path'),
_ = require('underscore'),
when = require('when'),
express = require('express'),
GhostPlugin = require('../../../core/server/plugins/GhostPlugin'),
knex = require('../../../core/server/models/base').Knex,
KudosPlugin;
KudosPlugin = function (ghost) {
@joeylin
joeylin / promise.js
Last active December 28, 2015 13:38
Create your own promise
var util = require('util');
var events = require('events');
function Promise(done) {
Promise.super_.call(this);
this.results = null;
this.errors = null;
this.ended = false;