Skip to content

Instantly share code, notes, and snippets.

View nazrdogan's full-sized avatar
🎯
Busy

Nazır Doğan nazrdogan

🎯
Busy
View GitHub Profile
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@ricardoalcocer
ricardoalcocer / themes.md
Last active October 15, 2021 08:10
Changing Android ActionBar Theme and Android Style

Customizing the overall App Style

This guide has been updated for Titanium SDK 3.3.0 which uses AppCompat to bring the ActionBar to Android 2.3.x

Android has a build-in theming system. Using this feature you can easily change the base color Android uses for its controls across your app, allowing you to provide better branding and personalization, while maintaining Android's UI and UX.

Android built-in themes are:

  • Holo (Mostly Black and Cyan)
  • Holo Light (Mostly White and Gray)
# -*- coding: utf-8 -*-
#
# cocos2d-x-icon-generator.py
# created by giginet on 2014/02/27
#
import sys
from PIL import Image
SIZES = (
(29, 29),
(40, 40),
@roccolucatallarita
roccolucatallarita / readme.txt
Created April 7, 2014 21:14
Create route in titanium map module
Create a file in your lib folder, like **rootproject**/lib/routes.map.js
load the module in your file and initialize with the data:
var jsonCoordinates = {
'destination': dest.latitude + ',' + dest.longitude,
'origin': origin.latitude + ',' + origin.longitude,
};
var routes = require("routes.map")(jsonCoordinates, mapview);
@tzmartin
tzmartin / sticky-table-headerview.js
Created December 9, 2014 01:53
Titanium Sticky Header
// just a quick n dirty test. See result: http://monosnap.com/file/wT6dJZ4zOrHzjiXi1mhfnIocEZiAWW
var headerView = Ti.UI.createView({
backgroundColor:'#fff',
height:80,
layout:'horizontal'
});
headerView.add(Ti.UI.createButton({title:'$100',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'}));
headerView.add(Ti.UI.createButton({title:'$500',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'}));
@FokkeZB
FokkeZB / !README.md
Last active April 13, 2016 14:28
Facebook's css-layout for Titanium

Facebook's css-layout for Titanium

Exploring how it could be used to have a more iOS-autolayout-like layout system on Titanium.

Getting the script to work

  1. Put Layout.js in app/lib.
  2. Put the below computeLayout.js in app/lib to fix this.
  3. Use the below alloy.js and confirm it to work.
@harshil93
harshil93 / SampleModel.js
Created June 8, 2015 07:11
Retrieving / Getting the current user id in a remote method in strongloop's loopback framework.
var loopback = require('loopback');
module.exports = function(SampleModel) {
// Returns null if the access token is not valid
function getCurrentUserId() {
var ctx = loopback.getCurrentContext();
var accessToken = ctx && ctx.get('accessToken');
var userId = accessToken && accessToken.userId;
return userId;
@justin-nodeboy
justin-nodeboy / api.js
Last active September 9, 2015 07:13
A simple API function for calling an endpoint in Titanium, see demo.js for usage
/**
Use this function to make calls to a JSON REST API see demo.js for useage
@param options
@param end (Callback)
**/
exports.api = function(options, end) {
//This function makes calls to an Endpoint and then sends the data back via callback to the function that requested it.
//Alloy.CFG.conn_url is set in your config.json file and can be accessed depending on which environment you are using.
var method = options.method,
@flpwgr
flpwgr / 030_modify_plist.sh
Created September 15, 2015 14:44
Cordova Hook for App Transport Security iOS 9
#!/bin/bash
PLIST=platforms/ios/*/*-Info.plist
cat << EOF |
Add :NSAppTransportSecurity dict
Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool YES
EOF
while read line
do
@haocong
haocong / karatsuba.js
Last active December 22, 2018 19:53
Karatsuba Multiplication in JavaScript
/**
* Karatsuba Multiplication
* @param {Number} x - first number
* @param {Number} y - second number
* @return {Number} Multiply of x and y
*/
function karatsubaMulti(x, y) {
let n = Math.min(('' + x).length, ('' + y).length);