- Rails: https://github.com/rails/pjax_rails
- Django: https://github.com/jacobian/django-pjax
- Asp.Net MVC3: http://biasecurities.com/blog/2011/using-pjax-with-asp-net-mvc3/
- FuelPHP: https://github.com/rcrowe/fuel-pjax
- Grails: http://www.bobbywarner.com/2012/04/23/add-some-pjax-to-grails/
- Express: https://github.com/abdelsaid/express-pjax-demo
import org.json.JSONArray; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
import java.util.*; | |
public class JsonHelper { | |
public static Object toJSON(Object object) throws JSONException { | |
if (object instanceof Map) { | |
JSONObject json = new JSONObject(); |
# remove from CRX all files deleted from file system | |
$ vlt st | grep ! | cut -c 2- | xargs -I {} vlt rm {} | |
# add to CRX all files not yet in vlt control | |
$ vlt st | grep \? | cut -c 2- | xargs -I {} vlt add {} | |
# add all missing files into the CRX | |
vlt st | grep ^A | cut -c 2- | xargs -I {} vlt commit --force {} | |
# copy all modified files into the CRX |
Set up your file structure for the innerParsys component: | |
innerParsys | |
-> parsys | |
-> new | |
- _cq_editConfig.xml | |
- .content.xml | |
- _cq_editConfig.xml | |
- .content.xml | |
- parsys.jsp |
# put this in your .bash_profile | |
if [ $ITERM_SESSION_ID ]; then | |
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND"; | |
fi | |
# Piece-by-Piece Explanation: | |
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment | |
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too | |
# the $PROMPT_COMMAND environment variable is executed every time a command is run | |
# see: ss64.com/bash/syntax-prompt.html |
#!/bin/bash | |
# | |
# git-mv-with-history -- move/rename file or folder, with history. | |
# | |
# Moving a file in git doesn't track history, so the purpose of this | |
# utility is best explained from the kernel wiki: | |
# | |
# Git has a rename command git mv, but that is just for convenience. | |
# The effect is indistinguishable from removing the file and adding another | |
# with different name and the same content. |
This is an example command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.
Here are the required steps to create a command:
-
Create a new Gist with a
command.js
andcommand.json
file, or simply fork this one. -
Write your JavaScript in
command.js
. This will be injected into and executed on the page the user is currently on when they run it. -
Add some metadata to the
command.json
file:
- name: The name of the command.
#!/usr/bin/ruby | |
require 'openssl' | |
if ARGV.length != 2 | |
puts "Usage:" | |
puts "./cq_password.rb HASHED_PASSWORD PLAIN_PASSWORD" | |
abort | |
end |
This gist is in response to a question asked on the Reddit Angular JS forum about how to structure an Angular app with roles and permissions.
There are many ways to approach this, but I'll share one that I've used before and maybe it will give you an idea. I'd combine all of the above into a single app and control who gets to see what using permissions. There are a few components to this approach...
First off I'd advise creating some sort of local session management service. This should be able to track whether you have an authenticated user and- if so- what types of permissions that user has. (Lots of ways to manage permissions. I'll assume your user object has either a 'role' enum or something simple like an array of string permissions.) You could roll your own session service or you could check out something like satellizer.
Let's assume yo