This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get YouTube ID from various YouTube URL | |
* @author: takien | |
* @url: http://takien.com | |
* For PHP YouTube parser, go here http://takien.com/864 | |
*/ | |
function YouTubeGetID(url){ | |
var ID = ''; | |
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.geom.Rectangle2D; | |
import java.awt.geom.Point2D; | |
public static final int FRAME_X = 1024; | |
public static final int FRAME_Y = 1024; | |
public static final int GENERATION_NUM = 4; | |
public static final int WALL_POWER = 10; | |
public static final int COFF_COULUMB = 1; | |
private ArrayList<Body> bodies; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Data.PQueue.Prio.Min as PQ | |
import qualified Data.HashSet as Set | |
import qualified Data.HashMap.Strict as Map | |
import Data.Hashable (Hashable) | |
import Data.List (foldl') | |
import Data.Maybe (fromJust) | |
astarSearch :: (Eq a, Hashable a) => a -> (a -> Bool) -> (a -> [(a, Int)]) -> (a -> Int) -> Maybe (Int, [a]) | |
astarSearch startNode isGoalNode nextNodeFn heuristic = | |
astar (PQ.singleton (heuristic startNode) (startNode, 0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The Oracle Java enum Planets example using the Klang DIY Enum, modified to include ordering. | |
*/ | |
object KlangEnumPlanets extends App { | |
trait Enum { //DIY enum type | |
import java.util.concurrent.atomic.AtomicReference //Concurrency paranoia | |
type EnumVal <: Value //This is a type that needs to be found in the implementing class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env runhaskell | |
-- Print sequence of moves for 4 discs from pin "A" to pin "C" | |
main = do putStrLn "Move stack of four discs from A to C:" | |
printNumberedList moves | |
where moves = hanoi 4 "A" "C" "B" | |
-- Return list of moves for moving stack of N discs from one pin to another | |
hanoi :: Show a => Int -> a -> a -> a -> [String] | |
hanoi 0 _ _ _ = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -fobjc-arc: enables ARC | |
# -fmodules: enables modules so you can import with `@import AppKit;` | |
# -mmacosx-version-min=10.6: support older OS X versions, this might increase the binary size | |
clang main.m -fobjc-arc -fmodules -mmacosx-version-min=10.6 -o main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<meta name="author" content=""> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import random | |
import matplotlib.pyplot as plot | |
from mpl_toolkits.mplot3d import Axes3D | |
class point: | |
def __init__(self, x,y,z): | |
self.x = x | |
self.y = y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Verify GitHub webhook signature header in Node.js | |
* Written by stigok and others (see gist link for contributor comments) | |
* https://gist.github.com/stigok/57d075c1cf2a609cb758898c0b202428 | |
* Licensed CC0 1.0 Universal | |
*/ | |
const crypto = require('crypto') | |
const express = require('express') | |
const bodyParser = require('body-parser') |
OlderNewer