Skip to content

Instantly share code, notes, and snippets.

View magick93's full-sized avatar
💩
Focusing

magick93

💩
Focusing
View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active November 2, 2024 12:56
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@mortezaadi
mortezaadi / persistence.xml
Last active July 23, 2024 00:45
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->
@acerosalazar
acerosalazar / IFMLCodeGenerator-Main.xtend
Last active April 27, 2017 21:24
A template for creating an Xtend based CodeGenerator using the Ecore implementation of the IFML metamodel and a sample model.
package generator
// This code is based on this stackoverflow answer:http://stackoverflow.com/questions/12458852/load-emf-model-instance-in-xtend
import org.eclipse.emf.common.util.URI
import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
import org.eclipse.emf.ecore.EPackage
@rastermanden
rastermanden / psql2markdown
Created March 11, 2015 20:26
termial alias to convert psql output to markdown tables
alias psql2markdown=" sed 's/+/|/g' | sed 's/^/|/' | sed 's/$/|/' | grep -v rows | grep -v '||'"
@henrik
henrik / danish_organization_number.rb
Last active May 15, 2020 07:26
Validate Danish organization numbers (CVR). Uses https://github.com/barsoom/attr_extras.
# Danish "CVR-nummer".
#
# A 7 digit serial number followed by a mod-11 check digit:
# https://erhvervsstyrelsen.dk/modulus-11-kontrol
#
# Search for real CVRs, to see examples: https://datacvr.virk.dk/data/
# E.g. 35408002, 30715063.
class DanishOrganizationNumber
MOD_11_WEIGHTS = [ 2, 7, 6, 5, 4, 3, 2 ]
@subfuzion
subfuzion / curl.md
Last active November 17, 2024 03:54
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@pfaocle
pfaocle / gen-d8-salt.sh
Created March 8, 2016 09:39
Generate Drupal 8 hash salt
drush eval "var_dump(Drupal\Component\Utility\Crypt::randomBytesBase64(55))"
@voskobovich
voskobovich / gist:537b2000108e4781f70b
Last active June 30, 2024 01:33
List of most currency ISO code and symbol format in SQL.
DROP TABLE currency;
-- Create table variable
CREATE TABLE currency (
name VARCHAR(20),
code VARCHAR(3),
symbol VARCHAR(5)
);
ALTER TABLE currency CONVERT TO CHARACTER SET utf8;
@thomasdarimont
thomasdarimont / readme.md
Last active August 31, 2021 14:13
Use Keycloak as Identity provider for Drupal
@johannesjo
johannesjo / table-to-json.js
Last active October 9, 2024 06:06
Snippet to convert html table to json (to be used with google chrome or similiar)
function tableToJson(table) {
var data = [];
// first row needs to be headers
var headers = [];
for (var i=0; i<table.rows[0].cells.length; i++) {
headers[i] = table.rows[0].cells[i].innerHTML.toLowerCase().replace(/ /gi,'');
}
// go through cells