Skip to content

Instantly share code, notes, and snippets.

View simison's full-sized avatar

Mikael Korpela simison

View GitHub Profile
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@blankg
blankg / WebViewBridge.js
Last active July 12, 2022 06:53
For RN >= 0.57 please look at https://github.com/blankg/rn-webview-bridge-sample-new/blob/master/resources/index.html. Provides a sample implementation for sending and receiving messages to and from the React-Native WebView (using postMessage/onMessage WebView API).
/**
* Created by Guy Blank on 3/9/17.
*
* This is a sample provides an API to send & receive messages to and from the React-Native WebView (using postMessage/onMessage WebView API).
* A sample project that uses the bridge is available here https://github.com/blankg/rn-webview-bridge-sample
*
* webViewBridge.send('functionToInvoke', {mydata: 'test'}, function(){console.log('success')},function(){console.log('error')});
*
* The API is designed to be similar to the Cordova exec API so migration to it should be almost seamless.
* The API also provides solution to a React-Native WebView bug in iOS which causes sending consecutive postMessage calls to override each other.
@danielwrobert
danielwrobert / wordpress-xml-splitter.py
Last active November 12, 2023 08:44
WordPress XML Splitter
'''
Created on May 8, 2010 by @anasimtiaz
Updated on May 28, 2016 by @danielwrobert
This is a "fork" of original script.
Original script URL: http://anasimtiaz.com/?p=51
'''
@zeroseis
zeroseis / disable-auto-android-file-transfer.md
Created September 14, 2015 17:28
Disable auto start for Android File Transfer
  • Close Android File Transfer
  • Open Activity Monitor and kill “Android File Transfer Agent”
  • Go to where you installed “Android File Transfer.app” (I have it under /Applications)
  • Ctrl+click –> “Show package contents”
  • Go to Contents/Resources
  • Rename “Android File Transfer Agent” to e.g. “Android File Transfer Agent_DISABLED”
  • Then go to “/Users/username/Library/Application Support/Google/Android File Transfer” and again rename the Agent app.
1) Run in the project folder :
$ npm install grunt-contrib-less --save-dev
2) Add less to config/env/all.js :
less: [
'public/modules/*/less/*.less'
],
and modify the css config to this :
css: [
'public/modules/*/less/*.css'
@subfuzion
subfuzion / mongo-autostart-osx.md
Last active March 2, 2022 00:57
mongo auto start on OS X

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

@Coopeh
Coopeh / nginx-multiple-if.conf
Created January 25, 2013 19:42
How to use multiple if statements in Nginx
set $posting 0; # Make sure to declare it first to stop any warnings
if ($request_method = POST) { # Check if request method is POST
set $posting N; # Initially set the $posting variable as N
}
if ($geoip_country_code ~ (BR|CN|KR|RU|UA) ) { # Here we're using the Nginx GeoIP module to block some spammy countries
set $posting "${posting}O"; # Set the $posting variable to itself plus the letter O
}
@tsileo
tsileo / duptools.sh
Created July 19, 2012 22:08
A bash script to simplify backup management with duplicity (encrypted incremental backups on amazon S3)
#!/bin/bash
export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY
export PASSPHRASE=YOU_PASSHRASE
# directories, space separated
SOURCE="/home/thomas/backup /home/thomas/bin /home/thomas/documents"
BUCKET=s3+http://mybucket
LOGFILE=/home/thomas/tmp/duplicity.log
# set email to receive a backup report
@andreyvit
andreyvit / fpdi_with_annots.php
Created March 12, 2012 07:16
FPDI extension to preserve external hyperlinks
<?php
// FPDI extension that preserves hyperlinks when copying PDF pages.
//
// (c) 2012, Andrey Tarantsov <andrey@tarantsov.com>, provided under the MIT license.
//
// Published at: https://gist.github.com/2020422
//
// Note: the free version of FPDI requires unprotected PDFs conforming to spec version 1.4.
// I use qpdf (http://qpdf.sourceforge.net/) to preprocess PDFs before running through this
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {