Skip to content

Instantly share code, notes, and snippets.

@pasza01
pasza01 / npmcrashcourse.txt
Created January 17, 2021 00:50 — forked from bradtraversy/npmcrashcourse.txt
NPM Crash Course Commands
# GET VERSION
npm -v (or --version)
# GET HELP
npm help
npm
# CREATE PACKAGE.JSON
npm init
npm init -y (or --yes)
@pasza01
pasza01 / GrizzlyHelper.java
Created August 22, 2018 23:01 — forked from nitincoded/GrizzlyHelper.java
Hibernate without XML
import com.fasterxml.classmate.AnnotationConfiguration;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import java.util.Properties;
/**
* Created by Developer on 1/7/17.
*/
@pasza01
pasza01 / MvcRestApplicationInitializer.java
Created February 22, 2018 21:53 — forked from joshlong/MvcRestApplicationInitializer.java
This is a complete working Spring MVC REST application. The only thing unspecified are the imports and the Maven pom.xml. Deploy this class as a .war using Spring MVC 3.2.x (and, specifically, the spring-webmvc library) and you're done!
/**
* <p>This will be picked up in a Servlet 3 environment like Apache Tomcat 7.
*
* <p>This replaces <code>web.xml</code>.
*
*/
public class MvcRestApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override protected Class<?> [] getRootConfigClasses() {
@pasza01
pasza01 / firebase.php
Created May 16, 2017 17:22 — forked from krhoyt/firebase.php
Interact with Firebase from PHP.
<?php
// Constants
$FIREBASE = "_YOUR_FIREBASE_URL_";
$NODE_DELETE = "temperature.json";
$NODE_GET = "temperature.json";
$NODE_PATCH = ".json";
$NODE_PUT = "temperature.json";
// Data for PUT
function APNStoFCM(token) {
var body = {
application : 'com.your.app',
sandbox : true,
apns_tokens : [
token
]
};
var options = {
var xmlhttp = new XMLHttpRequest();
var url = "http://api.twitch.tv/api/channels/lirik";
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var myArr = JSON.parse(xmlhttp.responseText);
myFunction(myArr);
}