Skip to content

Instantly share code, notes, and snippets.

View sudhanshuraheja's full-sized avatar

Sudhanshu Raheja sudhanshuraheja

View GitHub Profile
<?php if ( !(current_user_can('level_0')) ) { ?>
<h2>Login</h2>
<form action="<?php echo get_option('home'); ?>/wp-login.php" method="post">
<input
type="text"
name="log"
id="log"
value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>"
size="20" />
<input type="password" name="pwd" id="pwd" size="20" />
// Delegation methods
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
//RegisteringforRemoteNotifications
NSLog(@"%@ \n %@",
deviceToken,
[[NSString alloc] initWithData:deviceToken encoding:NSUTF8StringEncoding]
);
<?php
// Create a stream to the server
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', 'apns-dev.pem');
$apns = stream_socket_client(
'ssl://gateway.sandbox.push.apple.com:2195,
$error,
$errorString,
<?php
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', 'apns-dev.pem');
$apns = stream_socket_client(
'ssl://feedback.sandbox.push.apple.com:2196',
$error,
$errorString,
60,
<?php
$hooks_dir = '/svn/hooks/';
$repos_dir = '/svn/svn.localhost/';
$repo_hook_dir = $repos_dir . '__REPO__/hooks/';
if($hooks = opendir($hooks_dir)) {
while(($hook = readdir($hooks)) !== false) {
$unwanted = array('.', '..');
if(!in_array($hook, $unwanted)) {
<?php
function getRepoName($repo) {
return strtoupper(str_replace('/', '', str_replace('/svn/svn.localhost/', '', $repo)));
}
require_once('phpmail/class.phpmailer.php');
$repository = isset($argv[1]) ? $argv[1] : '';
$revision = isset($argv[2]) ? $argv[2] : '';
private function processFile() {
// The final response to send back to the browser
$response = array();
// Get the post value for file (we're passing the name of the file here)
// And make sure you check your routines for checking if this is valid etc
$file = $_POST['file']
// DISK_ROOT is defined in the project
$base_path = DISK_ROOT . '/app/cache/uploads/';
private function createManifest( $ipa_url, $bundle_id, $bundle_version, $title ) {
$xml = '<?xml version="1.0" encoding="UTF-8"' . urldecode( urlencode('?') . urlencode('>') ) . '
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
@sudhanshuraheja
sudhanshuraheja / gist:988500
Created May 24, 2011 10:39
Random PHP file
<?php
// This is how mixed up the tables get in even the simpler projects
// If you change the structure of the database, life sudden
$query .= '
SELECT
summary.recordlabel AS recordid,
summary.artist AS artistid,
summary.album AS albumid,
@Override
public View getView(int position, View convertView, ViewGroup paramViewGroup) {
Object current_event = mObjects.get(position);
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = inflater.inflate(R.layout.row_event, null);
holder.ThreeDimension = (ImageView) convertView.findViewById(R.id.ThreeDim);
holder.EventPoster = (ImageView) convertView.findViewById(R.id.EventPoster);
convertView.setTag(holder);