Skip to content

Instantly share code, notes, and snippets.

function doClickMenu(evt){
alert(evt.source.title);
}
// we need to do some things to the Window once it is properly instanciated, so we add an event listener to its OPEN event
$.win.addEventListener('open',function(){
var actionBar = $.win.activity.actionBar; // get a handle to the action bar
actionBar.title='My App'; // change the App Title
actionBar.displayHomeAsUp=true; // Show the "angle" pointing back
actionBar.onHomeIconItemSelected = function() { // what to do when the "home" icon is pressed
@winsonet
winsonet / app.js
Created January 10, 2014 08:53 — forked from aaronksaunders/app.js
Titanium.Facebook.appid = "YOUR APP ID";
Titanium.Facebook.permissions = ['publish_stream', 'read_stream', "user_checkins", "publish_checkins"];
function doFacebookCheckin(_callback) {
var getInfo = function(localCallback) {
// GOTCHA - You need to stringify the coordinates or the
// the API call will fail, this was a PITA to find
var data = {
@winsonet
winsonet / social.js
Last active August 28, 2015 07:44 — forked from rampicos/social.js
Social.js is the Appcelerator Titanium's Alloy Widget at first it is used to connect with Twitter only, though twitter and linkedin uses OAuth for its authentication I made some changes on Social.js for multi-purpose to connect Twitter and LinkedIn
function hex_sha1(s) {
return binb2hex(core_sha1(str2binb(s), s.length * chrsz));
}
function b64_sha1(s) {
return binb2b64(core_sha1(str2binb(s), s.length * chrsz));
}
function str_sha1(s) {
return binb2str(core_sha1(str2binb(s), s.length * chrsz));
public override void OnAuthorization(AuthorizationContext filterContext)
{
if (filterContext == null)
{
throw new ArgumentNullException("filterContext");
}
//get the current action for check the accessright
var currentAction = filterContext.RouteData.Values["Action"];
bool ignore = false;
[Acl("Account", AllowActions: "Index,View")]
public class CirculationController : BaseController
{
public CirculationController()
{
}
public ActionResult Index()
{
//do something...
public class AclAttribute : AuthorizeAttribute
{
string _notAllowRoles;
string _allowActions;
/// <summary>
/// Set the ACL attribute for access right
/// </summary>
/// <param name="NotAllowRoles">Not allow roles, split with comma</param>
/// <param name="AllowActions">Set the actions allow for the restrict roles</param>
@winsonet
winsonet / gist:a5bce78ea8850ffd3e167f43ee52313b
Last active September 11, 2023 06:50
Auto Health Check with Powershell
# Auto Health Check with Powershell
# By Winson
# https://www.Coderblog.in
# The root folder
$RootFloder = "$pwd\"
# Add the working directory to the environment path.