Skip to content

Instantly share code, notes, and snippets.

@auniverseaway
auniverseaway / gist:acafd834c20d7df3d329
Last active August 29, 2015 14:01
RestSharp vs PortableRest (GET / POST)
// POST Working in RestSharp
var client = new RestClient(url);
var request = new RestRequest("/oauth/access_token?client_id=" + clientid + "&client_secret=" + clientsecret, Method.POST);
request.AddParameter("grant_type", "password");
request.AddParameter("username", username);
request.AddParameter("password", password);
client.ExecuteAsync(request, response =>
{
// Do stuff with the response
});
public class SampleDataItem
{
public SampleDataItem(String uniqueId, String title, String subtitle, String imagePath, String description, String content)
{
this.UniqueId = uniqueId;
this.Title = title;
this.Subtitle = subtitle;
this.Description = description;
this.ImagePath = imagePath;
this.Content = content;
foreach ($podcasts as $podcast) {
$ourPodcast = Podcast::where('itunes_id', '=', $podcast->trackId)->first();
// If we don't have a record of the podcast, go ahead and create it.
if (is_null($ourPodcast))
{
$return[] = App::make('PodcastsController')->createFromItunes($podcast);
} else {
$return[] = $ourPodcast;
}
}
@auniverseaway
auniverseaway / gist:2ffb4799a6f05eaa997e
Last active August 29, 2015 14:04
API Controller
public function getRecentEpisodes()
{
$podcastid = Input::get('podcast_id');
$podcast = Podcast::find($podcastid);
$episode = Podcast::find($podcastid)->episodes()->first();
if(!$episode)
{
@auniverseaway
auniverseaway / gist:fcfb94f2b924ccacbc92
Created November 25, 2014 16:11
EpisodeView Play_Tapped
if(App.EpisodeViewModel.IsOpen && App.EpisodeViewModel.IsPlaying)
{
// Pause
Debug.WriteLine("Pause");
App.EpisodeViewModel.Pause();
}
else if (App.EpisodeViewModel.IsOpen)
{
// Play current
Debug.WriteLine("Play Current");
public function getHash($hash)
{
$binary = $this->base64url_decode($hash);
$values = unpack("LS", $binary);
var_dump(bin2hex($binary));
var_dump($values);
$episodeId = $values['S'];
@auniverseaway
auniverseaway / gist:1d48b8e7ded0652ced0f
Created December 17, 2014 17:12
Image Class tying into Imagine Framework on Laravel
<?php namespace App\Services;
use Config, File, Log;
class Image {
/**
* Instance of the Imagine package
* @var Imagine\Gd\Imagine
*/
random-read: (groupid=0, jobs=1): err= 0: pid=9536: Mon Jan 5 15:33:54 2015
write: io=131072KB, bw=970904KB/s, iops=242725 , runt= 135msec
clat (usec): min=2 , max=33 , avg= 3.16, stdev= 0.85
lat (usec): min=2 , max=33 , avg= 3.25, stdev= 0.86
clat percentiles (usec):
| 1.00th=[ 2], 5.00th=[ 2], 10.00th=[ 3], 20.00th=[ 3],
| 30.00th=[ 3], 40.00th=[ 3], 50.00th=[ 3], 60.00th=[ 3],
| 70.00th=[ 3], 80.00th=[ 3], 90.00th=[ 4], 95.00th=[ 5],
| 99.00th=[ 6], 99.50th=[ 7], 99.90th=[ 9], 99.95th=[ 12],
| 99.99th=[ 21]
random-read: (groupid=0, jobs=1): err= 0: pid=8378: Mon Jan 5 15:15:17 2015
write: io=131072KB, bw=910222KB/s, iops=227555 , runt= 144msec
clat (usec): min=2 , max=33 , avg= 2.82, stdev= 0.80
lat (usec): min=2 , max=33 , avg= 2.90, stdev= 0.79
clat percentiles (usec):
| 1.00th=[ 2], 5.00th=[ 2], 10.00th=[ 2], 20.00th=[ 2],
| 30.00th=[ 2], 40.00th=[ 3], 50.00th=[ 3], 60.00th=[ 3],
| 70.00th=[ 3], 80.00th=[ 3], 90.00th=[ 3], 95.00th=[ 4],
| 99.00th=[ 5], 99.50th=[ 6], 99.90th=[ 9], 99.95th=[ 11],
| 99.99th=[ 15]
@auniverseaway
auniverseaway / gist:3ecc78096a6dbfa038df
Created January 20, 2015 20:23
"Create Grid View" in AEM
CQ.Ext.onLoad(function() {
var config = {
"xtype": "sandiskCustomDataviewlens",
"style": "overflow:visible;",
"renderButtonTo": "lens-mosaic-button-wrapper-<%= time %>",
"proxyConfig": {
"url": "/bin/wcm/contentfinder/view.json/content/dam"
},
"storeConfig": {
"baseParams": {