Skip to content

Instantly share code, notes, and snippets.

View jackbillstrom's full-sized avatar
🇺🇦
slava ukraini 🔱

Jack Billström jackbillstrom

🇺🇦
slava ukraini 🔱
View GitHub Profile
$('.example-twitter-oss .typeahead').typeahead({
name: 'twitter-oss',
prefetch: '../data/repos.json',
template: [
'<p class="repo-language">{{language}}</p>',
'<p class="repo-name">{{name}}</p>',
'<p class="repo-description">{{description}}</p>'
].join(''),
engine: Hogan
});
@danharper
danharper / BorderedInput.js
Last active May 16, 2016 20:31
BorderedInput, with Material design style focus animation. Preview: https://i.imgur.com/Fek7rXF.gif
// note there may be a better way to abuse flexbox than this :)
var React = require('react-native')
var { View, TextInput } = React
var BorderedInput = React.createClass({
getInitialState() {
return { i: 0 }
},
@adamjohnson
adamjohnson / skeleton_wide.css
Created February 21, 2012 16:15
1200px Media Query for the Skeleton Grid
/* 1200px Media Query for the Skeleton Grid - http://getskeleton.com
* Adapted from http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/responsive-css-grid-systems-345
* Added .alpha.omega combo classes. Hope to see that fixed in later versions of Skeleton: https://github.com/dhgamache/Skeleton/issues/68
*/
@media only screen and (min-width: 1200px) {
.container { width: 1200px;}
.container .column,
.container .columns { margin-left: 10px; margin-right: 10px; }
@amineeg
amineeg / app.js
Created February 27, 2014 22:01
Get started angularJs, send data from angularJs to Php, decode json data in php, best practice
'use strict';
// Declare app level module which depends on filters, and services
var app= angular.module('myApp', ['ngRoute']);
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'loginCtrl'});
$routeProvider.otherwise({redirectTo: '/login'});
}]);
@jackbillstrom
jackbillstrom / command.sh
Last active July 21, 2020 00:21
How to renew a expired Let's Encrypt certificate via certbot
# This command will be generating a TXT-string you'll need to enter into your "_acme-challenge.example.se"
# When the new DNS post is live, you'll want to press ENTER in your shell to complete setup.
# My setup is a Debian machine with Apache as Web Server with virtualhosts.
sudo certbot-auto --server https://acme-v02.api.letsencrypt.org/directory -d "*.example.se" --preferred-challenges dns-01 certonly
@woogists
woogists / wc-override-loop-show-cart-buttons.php
Last active July 9, 2021 09:53
[Frontend Snippets] Override loop template and show quantities next to add to cart buttons.
/**
* Override loop template and show quantities next to add to cart buttons
*/
add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
$html .= woocommerce_quantity_input( array(), $product, false );
$html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
$html .= '</form>';
@benjamintanweihao
benjamintanweihao / working_with_dates.swift
Created November 4, 2014 01:57
Working with Dates, Calendars in Swift.
// Playground - noun: a place where people can play
import UIKit
// Setup the calendar object
let calendar = NSCalendar.currentCalendar()
// Set up date object
let date = NSDate()
@iansym
iansym / jsonview-solarized.css
Last active September 13, 2022 21:33
JSON View solarized theme for Chrome Extension
body {
background-color: #002b36;
color: #839496;
font-size: 14px;
white-space: pre !important;
font-family: "Source Code Pro", monospace;
}
.property {
font-weight: bold;
@miya0001
miya0001 / cors-for-the-wordpress-rest-api.php
Last active January 31, 2023 07:42
CORS for the WordPress REST API
<?php
function my_customize_rest_cors() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: GET' );
header( 'Access-Control-Allow-Credentials: true' );
header( 'Access-Control-Expose-Headers: Link', false );
@saxman
saxman / MainActivity.java
Created April 9, 2013 16:31
Plotting markers on a map in Android using data from a JSON web service and the Google Maps Android API v2
/*
* Copyright (c) 2013 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express