Skip to content

Instantly share code, notes, and snippets.

@openqubit
openqubit / gist:93502b37ef04a71555dba3ea309f1fc4
Created March 30, 2017 11:59 — forked from anonymous/gist:4440000
User impersonation HACK for Ion_Auth CodeIgniter library.
/**
* impersonate
*
* @return bool
* @author Nuri
**/
public function impersonate($identity)
{
$admin = check_admin();
@openqubit
openqubit / stringfy.js
Last active January 8, 2017 19:20
Stringfy object functions in javascript https://jsfiddle.net/p24b9f8n/38/
var stringify = function(obj, prop) {
var placeholder = '____PLACEHOLDER____';
var fns = [];
var json = JSON.stringify(obj, function(key, value) {
if (typeof value === 'function') {
fns.push(value);
return placeholder;
}
return value;
@openqubit
openqubit / stringify.js
Created January 8, 2017 18:30 — forked from cowboy/stringify.js
JavaScript: like JSON.stringify but handles functions, good for creating arbitrary .js objects?
var stringify = function(obj, prop) {
var placeholder = '____PLACEHOLDER____';
var fns = [];
var json = JSON.stringify(obj, function(key, value) {
if (typeof value === 'function') {
fns.push(value);
return placeholder;
}
return value;
}, 2);
@openqubit
openqubit / letsencrypt_2016.md
Created December 20, 2016 11:44 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two modes when you don't want Certbot to edit your configuration:

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80) to renew certificates.

In the following, we're setting up mydomain.com to be served from /var/www/mydomain, and challenges will be served from /var/www/letsencrypt.

@openqubit
openqubit / getdates.js
Created November 4, 2016 07:59 — forked from miguelmota/getDates.js
Get dates in between two dates with JavaScript.
// Returns an array of dates between the two dates
var getDates = function(startDate, endDate) {
var dates = [],
currentDate = startDate,
addDays = function(days) {
var date = new Date(this.valueOf());
date.setDate(date.getDate() + days);
return date;
};
while (currentDate <= endDate) {
Template.NotFound.onCreated(function () {
GoogleMaps.ready('map2', function(map2) {
google.maps.event.addListener(map2.instance, 'click', function(event) {
Markers.insert({ lat: event.latLng.lat(), lng: event.latLng.lng() });
});
var markers = {};
<html>
<head>
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
</head>
<body>
<div id="map" style="height: 400px; width: 500px;">
</div>
<script type="text/javascript">
qubit@qubit-HP-EliteBook-2540p:~/ft$ iron build --server=192.168.43.160:3000
> meteor build /home/qubit/ft/build --directory --server=192.168.43.160:3000
ANDROID_HOME=/home/qubit/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-7-oracle
null
embedded
org.xwalk:xwalk_core_library:17+
@openqubit
openqubit / gist:d47e235a9f2384684a66035702fa7427
Created May 5, 2016 22:26 — forked from mattm/gist:1633149
Calling Big Huge Thesaurus's API with jQuery
$.ajax({
url : "http://words.bighugelabs.com/api/2/youapikey/" + word + "/json?callback=?",
dataType : 'json',
complete : function(jqXHR, textStatus) {
if (textStatus == 'parsererror') {
// Did not find any synonyms
alert("404 error because no synonyms exist for this word");
}
},
success : function(data) {
@openqubit
openqubit / Schema
Last active June 13, 2016 22:40
Creating A User Using Autoform
Schema = {};
Schema.UserProfile = new SimpleSchema({
schoolname: {
label: "School Name",
optional: false,
type: String
},
schooldescription: {
label: "School Description",