Skip to content

Instantly share code, notes, and snippets.

View zoghal's full-sized avatar
🏠
Working from home

Saleh Souzanchi zoghal

🏠
Working from home
View GitHub Profile
@jbasdf
jbasdf / inactivity-warning.js
Created January 2, 2014 23:14
Javascript for Ember inactivity component
App.InactivityWarningComponent = Ember.Component.extend({
active: false,
inactiveTimeout: 12000000, // Amount of time before we redirect to the sign in screen - the session should have expired by this point. (20 minutes)
warningTimeout: 30000, // Amount of time the user has to perform an action before the last keep alive fires - 30 seconds
timeout: 1170000, // 19.5 minutes. We want to be less than the 20 minute timeout to be sure the session is renewed.
didInsertElement: function(){
//if($('meta[name="in-development"]').attr('content')){ return; } // Uncomment and add a meta tag to your head if you want to avoid session timeout in development
var context = this;
@WilHall
WilHall / WebpageThumbnailsInPython.md
Created November 29, 2013 00:45
Webpage Thumbnails In Python

#Webpage Thumbnails In Python A small WSGI script that uses selenium's headless PhantomJS driver to capture webpage screenshots, and PIL to resize them. Cropping options could easily be added.

##Dependencies

  • Python selenium
  • Python PIL
  • PhantomJS
@slindberg
slindberg / README.md
Last active June 15, 2025 21:43
Ember debug helpers intended to be used in the JavaScript console

Ember.Console

This is a set of helpers for finding the application's currently active models/routes/controllers/etc. This isn't a straightforward process because of how Ember (rightly) encapsulates application objects, but it's useful in debugging environments to be able to quickly access them. And with the beta release of Ember Data, the store is not easily accessible without helpers either.

Usage

All helpers can be called directly if you provide them an application instance:

Guide to loading/error events and substates

In addition to the techniques described in the Asynchronous Routing Guide, the Ember Router provides powerful yet overridable conventions for customizing asynchronous transitions between routes by making use of error and loading substates.

loading substates

@plentz
plentz / nginx.conf
Last active May 27, 2025 10:32
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
import DS from 'ember-data';
import {RSVP} from 'ember';
var Adapter = DS.RESTAdapter.extend({
namespace: 'api/v1',
findAll: function(store, type, sinceToken) {
var url = this.buildURL(type.typeKey);
var cached = localStorage.getItem(url);
@sebastianseilund
sebastianseilund / merged_array.js
Last active December 20, 2015 07:58
An implementation of a merged array in Ember.js that combines items from multiple source arrays so you can easily list them together in your Handlebars templates. Read the blog post at the [Billy's Billing Developer Blog](http://dev.billysbilling.com/blog/How-to-merge-multiple-data-sources-into-one-array-in-Ember-js)
/**
* `Ember.MergedArray` is an array that observes multiple other arrays (called source arrays) for changes and includes
* all items from all source arrays in an efficient way.
*
* Usage:
*
* ```javascript
* var obj = Ember.Object.create({
* people: [
* {
@gpoitch
gpoitch / google_analytics_mixin.js
Last active December 16, 2015 16:40
A Google Analytics mixin for an Ember application controller. Sends a page view whenever the currentPath (url) changes. Normalizes the page url for both history and hash location routers.
Ember.GoogleAnalytics = Ember.Mixin.create({
trackPageView: function() {
if(!Ember.isNone(ga)) {
Ember.run.next(function() {
var loc = window.location,
page = loc.hash ? loc.hash.substring(1) : loc.pathname + loc.search;
ga('send', 'pageview', page);
});
}