Skip to content

Instantly share code, notes, and snippets.

@jdnichollsc
jdnichollsc / docsController.js
Last active January 26, 2016 10:39
PouchDB with SQLite plugin in Ionic Framework (Pre-populated database) => Using service pattern
controllers.controller('DocsController', ['$scope', '$ionicPlatform', 'Docs', 'Products' function ($scope, $ionicPlatform, Docs, Products) {
$scope.products = [];
$scope.allDocs = [];
$ionicPlatform.ready(function () {
//Insert a new product
Products.addProduct({
name : 'Milk',
@kovrov
kovrov / bootstrap.pro
Last active January 27, 2017 22:20
QML components bootstrap.
TEMPLATE = lib
QT += declarative
CONFIG += qt plugin
TARGET = $$qtLibraryTarget($$TARGET)
# for qtcreator
uri = com.example.bootstrap
#DESTDIR = $$replace(uri, \\., /)
@strukturedkaos
strukturedkaos / MainActivity.java
Created February 1, 2012 17:50
Android Authentication Example
package com.sexifit.android;
import java.io.IOException;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@paceaux
paceaux / CSSOM
Last active August 22, 2018 01:06
CSSOM debugger See the stylesheets and the rules in the stylesheets.
window.analyzer = {
init: function (object, id) {
this.functions.appendTable(id);
this.functions.setupHeaders(object);
this.functions.addData(object);
this.functions.addCaption("Analysis of the stylesheets");
},
data: {},
helpers: {
wrapper: function (id) {
@eeertekin
eeertekin / backend-architectures.md
Last active September 23, 2019 09:21 — forked from ngocphamm/backend-architectures.md
Backend Architectures
@enjalot
enjalot / cors_server.py
Created June 10, 2012 06:19
Allow CORS with python simple http server
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
@dwayne
dwayne / 00-ionic-notes.md
Last active October 13, 2022 15:05
My notes on the Ionic Framework.
@slevithan
slevithan / xregexp-lookbehind2.js
Created April 14, 2012 21:06
Simulating lookbehind in JavaScript (take 2)
// Simulating infinite-length leading lookbehind in JavaScript. Uses XRegExp.
// Captures within lookbehind are not included in match results. Lazy
// repetition in lookbehind may lead to unexpected results.
(function (XRegExp) {
function prepareLb(lb) {
// Allow mode modifier before lookbehind
var parts = /^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*)\)$/.exec(lb);
return {
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@JPvRiel
JPvRiel / linux_memory_control_to_avoid_swap_thrashing.md
Created November 7, 2016 22:29
Notes on linux memory management options to prioritize and control memory access using older ulimits, newer cgroups and overcommit policy settings. Mostly as an attempt to keep a desktop environment responsive and avoid swap thrashing under high memory pressure.

Overview

Some notes about:

  • Explaining why current day Linux memory swap thrashing still happens (as of 2016).
  • Mitigating "stop the world" type thrashing issues on a Linux workstation when it's under high memory pressure and where responsiveness is more important than process completion.
  • Prioritizing and limiting memory use.
  • Older ulimit versus newer CGroup options.

These notes assume some basic background knowledge about memory management, ulimits and cgroups.