Skip to content

Instantly share code, notes, and snippets.

View Samuell1's full-sized avatar
🖖

Samuel Samuell1

🖖
View GitHub Profile
ipcMain.on('printPdf', (event, pdf) => {
printWindow = new BrowserWindow({width: 800, height: 600})
printWindow.loadURL("data:text/html," + pdf)
printWindow.webContents.on("did-finish-load", function() {
// Use default printing options
printWindow.webContents.printToPDF({}, function(error, data) {
if (error) throw error
fs.writeFile(app.getPath('desktop') + '/test.pdf', data, function(err) {
if (err)
Object.keys(emptyObject).forEach((key) => {
this.$set(this.newData, key, emptyObject[key])
})
@Samuell1
Samuell1 / IntrospectionQuery.graphql
Last active April 6, 2017 11:38
Query to get Introspection Query from GraphiQL/GraphQL server
query IntrospectionQuery {
__schema {
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
@Samuell1
Samuell1 / app.js
Created November 24, 2016 12:17 — forked from jmdobry/app.js
js-data + js-data-firebase + js-data-localstorage
var fb = new DSFirebaseAdapter({
basePath: 'https://my-app.firebase.io'
});
var ls = new DSLocalStorageAdapter();
var store = new JSData.DS({
// try firebase first, otherwise try offline data
fallbackAdapters: ['fb', 'ls'],
// After creating an item, sync it to localStorage
@Samuell1
Samuell1 / status.php
Last active August 29, 2015 14:14 — forked from dkesberg/status.php
<?php
/**
* @author Daniel Kesberg <[email protected]>
* @copyright (c) 2013, Daniel Kesberg
*/
error_reporting(E_ALL);
ini_set('display_errors', false);
$parseTimeStart = microtime();
<?php
/**
* File: SimpleImage.php
* Author: Simon Jarvis
* Modified by: Miguel Fermín
* Based in: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
/**
* source: http://stackoverflow.com/questions/3203354/php-script-to-render-a-single-transparent-pixel-png-or-gif
*/
// transparent 1x1 png
header('Content-Type: image/png');
echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=');
// transparent 1x1 gif
header('Content-Type: image/gif');